toggleDevice

Switch specified device current power state.

Usage

  const status = await connection.toggleDevice('<your device id>');
  console.log(status);
  // multi-channel devices like Sonoff 4CH
  const status = await connection.toggleDevice('<your device id>', <channel>);
  console.log(status);

* Remember to instantiate class before use

Response example

  {
    status: 'ok',
    state: 'off'
  }
Last update on: September 15th, 2019