sendPowerOnOffAction method

Future<void> sendPowerOnOffAction(
  1. bool desiredOnOffState, {
  2. GetDeviceDetailsMethod getDetails = DevicesRepository.getDeviceDetails,
  3. SendPowerMethod sendPowerMethod = PowerRepository.sendPowerAction,
})

Run the "makePowerActionRequest" mutation on this device

@param desiredOnOffState use true to set power state to on, false otherwise @throws ServerException for any errors returned by the platform

Implementation

Future<void> sendPowerOnOffAction(bool desiredOnOffState,
    {GetDeviceDetailsMethod getDetails = DevicesRepository.getDeviceDetails,
    SendPowerMethod sendPowerMethod =
        PowerRepository.sendPowerAction}) async {
  return performAction<bool>(desiredOnOffState, () => getOnOffState,
      () => sendPowerMethod(_request, this._deviceId, desiredOnOffState),
      getDetails: getDetails);
}