Sensor detecting presence in the vicinity.
More...
#include <hueplusplus/ZLLSensors.h>
|
| 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...
|
|
int | id |
| holds the id of the device More...
|
|
APICache | state |
| holds the current state of the device More...
|
|
Sensor detecting presence in the vicinity.
◆ ZLLPresence()
hueplusplus::sensors::ZLLPresence::ZLLPresence |
( |
Sensor |
sensor | ) |
|
|
inlineexplicit |
Construct from generic sensor.
◆ getBatteryState()
int hueplusplus::sensors::ZLLPresence::getBatteryState |
( |
| ) |
const |
Get battery state.
- Returns
- Battery state in percent
◆ getLastAlert()
Alert hueplusplus::sensors::ZLLPresence::getLastAlert |
( |
| ) |
const |
Get last sent alert.
- Note
- This is not cleared when the alert ends.
◆ getLastUpdated()
Get time of last status update.
- Returns
- The last update time, or a time with a zero duration from epoch if the last update time is not set.
◆ getMaxSensitivity()
int hueplusplus::sensors::ZLLPresence::getMaxSensitivity |
( |
| ) |
const |
◆ getPresence()
bool hueplusplus::sensors::ZLLPresence::getPresence |
( |
| ) |
const |
◆ getSensitivity()
int hueplusplus::sensors::ZLLPresence::getSensitivity |
( |
| ) |
const |
◆ hasBatteryState()
bool hueplusplus::sensors::ZLLPresence::hasBatteryState |
( |
| ) |
const |
Check whether the sensor has a battery state.
◆ isOn()
bool hueplusplus::sensors::ZLLPresence::isOn |
( |
| ) |
const |
Check if sensor is on.
Sensors which are off do not change their status
◆ isReachable()
bool hueplusplus::sensors::ZLLPresence::isReachable |
( |
| ) |
const |
Check whether the sensor is reachable.
◆ sendAlert()
void hueplusplus::sensors::ZLLPresence::sendAlert |
( |
Alert |
type | ) |
|
Send alert.
- Exceptions
-
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 |
◆ setOn()
void hueplusplus::sensors::ZLLPresence::setOn |
( |
bool |
on | ) |
|
Enable or disable sensor.
- Exceptions
-
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 |
◆ setSensitivity()
void hueplusplus::sensors::ZLLPresence::setSensitivity |
( |
int |
sensitivity | ) |
|
Set sensor sensitivity.
- Parameters
-
sensitivity | Sensitivity from 0 to max sensitivity (inclusive) |
◆ typeStr
constexpr const char * hueplusplus::sensors::ZLLPresence::typeStr = "ZLLPresence" |
|
static |
The documentation for this class was generated from the following files: