hueplusplus
1.0.0
|
ZigBee sensor detecting ambient light level. More...
#include <hueplusplus/ZLLSensors.h>
Public Member Functions | |
ZLLLightLevel (Sensor sensor) | |
Construct from generic sensor. More... | |
bool | isOn () const |
Check if sensor is on. More... | |
void | setOn (bool on) |
Enable or disable sensor. More... | |
bool | hasBatteryState () const |
Check whether the sensor has a battery state. More... | |
int | getBatteryState () const |
Get battery state. More... | |
bool | isReachable () const |
Check whether the sensor is reachable. More... | |
int | getDarkThreshold () const |
Get threshold to detect darkness. More... | |
void | setDarkThreshold (int threshold) |
Set threshold to detect darkness. More... | |
int | getThresholdOffset () const |
Get offset over dark threshold to detect daylight. More... | |
void | setThresholdOffset (int offset) |
Set offset to detect daylight. More... | |
int | getLightLevel () const |
Get measured light level. More... | |
bool | isDark () const |
Check whether light level is below dark threshold. More... | |
bool | isDaylight () const |
Check whether light level is above light threshold. More... | |
time::AbsoluteTime | getLastUpdated () const |
Get time of last status update. More... | |
Public Member Functions inherited from hueplusplus::BaseDevice | |
virtual | ~BaseDevice ()=default |
Virtual destructor. More... | |
virtual int | getId () const |
Const function that returns the id of this device. More... | |
virtual std::string | getType () const |
Const function that returns the device type. More... | |
virtual std::string | getName () |
Function that returns the name of the device. More... | |
virtual std::string | getName () const |
Const function that returns the name of the device. More... | |
virtual std::string | getModelId () const |
Const function that returns the modelid of the device. More... | |
virtual std::string | getUId () const |
Const function that returns the uniqueid of the device. More... | |
virtual std::string | getManufacturername () const |
Const function that returns the manufacturername of the device. More... | |
virtual std::string | getProductname () const |
Const function that returns the productname of the device. More... | |
virtual std::string | getSwVersion () |
Function that returns the software version of the device. More... | |
virtual std::string | getSwVersion () const |
Const function that returns the software version of the device. More... | |
virtual bool | setName (const std::string &name) |
Function that sets the name of the device. More... | |
virtual void | refresh (bool force=false) |
Refreshes internal cached state. More... | |
virtual void | setRefreshDuration (std::chrono::steady_clock::duration refreshDuration) |
Sets custom refresh interval for this device. More... | |
Static Public Attributes | |
static constexpr const char * | typeStr = "ZLLLightLevel" |
ZLLLightLevel sensor type name. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from hueplusplus::BaseDevice | |
BaseDevice (int id, const std::shared_ptr< APICache > &baseCache) | |
Protected ctor that is used by subclasses, construct with shared cache. More... | |
BaseDevice (int id, const HueCommandAPI &commands, const std::string &path, std::chrono::steady_clock::duration refreshDuration, const nlohmann::json ¤tState) | |
Protected ctor that is used by subclasses. More... | |
virtual nlohmann::json | sendPutRequest (const std::string &subPath, const nlohmann::json &request, FileInfo fileInfo) |
Utility function to send a put request to the device. More... | |
Protected Attributes inherited from hueplusplus::BaseDevice | |
int | id |
holds the id of the device More... | |
APICache | state |
holds the current state of the device More... | |
ZigBee sensor detecting ambient light level.
|
inlineexplicit |
Construct from generic sensor.
int hueplusplus::sensors::ZLLLightLevel::getBatteryState | ( | ) | const |
Get battery state.
int hueplusplus::sensors::ZLLLightLevel::getDarkThreshold | ( | ) | const |
Get threshold to detect darkness.
time::AbsoluteTime hueplusplus::sensors::ZLLLightLevel::getLastUpdated | ( | ) | const |
Get time of last status update.
int hueplusplus::sensors::ZLLLightLevel::getLightLevel | ( | ) | const |
Get measured light level.
10000*log10(lux)+1
(logarithmic scale) int hueplusplus::sensors::ZLLLightLevel::getThresholdOffset | ( | ) | const |
Get offset over dark threshold to detect daylight.
bool hueplusplus::sensors::ZLLLightLevel::hasBatteryState | ( | ) | const |
Check whether the sensor has a battery state.
bool hueplusplus::sensors::ZLLLightLevel::isDark | ( | ) | const |
Check whether light level is below dark threshold.
bool hueplusplus::sensors::ZLLLightLevel::isDaylight | ( | ) | const |
Check whether light level is above light threshold.
Light threshold is dark threshold + offset
bool hueplusplus::sensors::ZLLLightLevel::isOn | ( | ) | const |
Check if sensor is on.
Sensors which are off do not change their status
bool hueplusplus::sensors::ZLLLightLevel::isReachable | ( | ) | const |
Check whether the sensor is reachable.
void hueplusplus::sensors::ZLLLightLevel::setDarkThreshold | ( | int | threshold | ) |
Set threshold to detect darkness.
threshold | Light level as reported by getLightLevel |
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
void hueplusplus::sensors::ZLLLightLevel::setOn | ( | bool | on | ) |
Enable or disable sensor.
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
void hueplusplus::sensors::ZLLLightLevel::setThresholdOffset | ( | int | offset | ) |
Set offset to detect daylight.
offset | Offset to dark threshold to detect daylight. Must be greater than 1. |
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
|
static |
ZLLLightLevel sensor type name.