SinricPro Library
|
Device to report power usage. More...
Public Types | |
typedef std::function< bool(const String &, bool &)> | PowerStateCallback |
Callback definition for onPowerState function. More... | |
Public Member Functions | |
bool | sendPowerSensorEvent (float voltage, float current, float power=-1.0f, float apparentPower=-1.0f, float reactivePower=-1.0f, float factor=-1.0f, String cause="PERIODIC_POLL") |
Send PowerSensor event to SinricPro Server. More... | |
virtual void | onPowerState (PowerStateCallback cb) |
Set callback function for powerState request. More... | |
bool | sendPowerStateEvent (bool state, String cause="PHYSICAL_INTERACTION") |
Send setPowerState event to SinricPro Server indicating actual power state. More... | |
Device to report power usage.
|
inherited |
Callback definition for onPowerState function.
Gets called when device receive a setPowerState
reuqest
[in] | deviceId | String which contains the ID of device |
[in] | state | true = device is requested to turn on false = device is requested to turn off |
[out] | state | true = device has been turned on false = device has been turned off |
true | request handled properly |
false | request was not handled properly because of some error |
|
virtualinherited |
Set callback function for powerState
request.
cb | Function pointer to a PowerStateCallback function |
bool sendPowerSensorEvent | ( | float | voltage, |
float | current, | ||
float | power = -1.0f , |
||
float | apparentPower = -1.0f , |
||
float | reactivePower = -1.0f , |
||
float | factor = -1.0f , |
||
String | cause = "PERIODIC_POLL" |
||
) |
Send PowerSensor event to SinricPro Server.
voltage | voltage |
current | current |
power | (optional) if not provided, it is calculated automaticly (power = voltage * current) |
apparentPower | (optional) if not provided it is set to -1 |
reactivePower | (optional) if not provided it is set to -1 |
factor | (optional) if not provided it is set to -1 if apparentPower is provided, factor is calculated automaticly (factor = power / apparentPower) |
cause | (optional) Reason why event is sent (default = "PERIODIC_POLL" ) |
true | event has been sent successfully |
false | event has not been sent, maybe you sent to much events in a short distance of time |
|
inherited |
Send setPowerState
event to SinricPro Server indicating actual power state.
state | true = device turned on false = device turned off |
cause | (optional) String reason why event is sent (default = "PHYSICAL_INTERACTION" ) |
true | event has been sent successfully |
false | event has not been sent, maybe you sent to much events in a short distance of time |