hueplusplus  1.0.0
Public Member Functions | Static Public Attributes | List of all members
hueplusplus::sensors::ZLLTemperature Class Reference

ZigBee temperature sensor. More...

#include <hueplusplus/ZLLSensors.h>

+ Inheritance diagram for hueplusplus::sensors::ZLLTemperature:
+ Collaboration diagram for hueplusplus::sensors::ZLLTemperature:

Public Member Functions

 ZLLTemperature (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...
 
Alert getLastAlert () const
 Get last sent alert. More...
 
void sendAlert (Alert type)
 Send alert. More...
 
bool isReachable () const
 Check whether the sensor is reachable. More...
 
int getTemperature () const
 Get recorded temperature. 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 = "ZLLTemperature"
 ZLLTemperature 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 &currentState)
 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...
 

Detailed Description

ZigBee temperature sensor.

Constructor & Destructor Documentation

◆ ZLLTemperature()

hueplusplus::sensors::ZLLTemperature::ZLLTemperature ( Sensor  sensor)
inlineexplicit

Construct from generic sensor.

Member Function Documentation

◆ getBatteryState()

int hueplusplus::sensors::ZLLTemperature::getBatteryState ( ) const

Get battery state.

Returns
Battery state in percent

◆ getLastAlert()

Alert hueplusplus::sensors::ZLLTemperature::getLastAlert ( ) const

Get last sent alert.

Note
This is not cleared when the alert ends.

◆ getLastUpdated()

time::AbsoluteTime hueplusplus::sensors::ZLLTemperature::getLastUpdated ( ) const

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.

◆ getTemperature()

int hueplusplus::sensors::ZLLTemperature::getTemperature ( ) const

Get recorded temperature.

Returns
Temperature in 0.01 degrees Celsius.

◆ hasBatteryState()

bool hueplusplus::sensors::ZLLTemperature::hasBatteryState ( ) const

Check whether the sensor has a battery state.

◆ isOn()

bool hueplusplus::sensors::ZLLTemperature::isOn ( ) const

Check if sensor is on.

Sensors which are off do not change their status

◆ isReachable()

bool hueplusplus::sensors::ZLLTemperature::isReachable ( ) const

Check whether the sensor is reachable.

◆ sendAlert()

void hueplusplus::sensors::ZLLTemperature::sendAlert ( Alert  type)

Send alert.

Exceptions
std::system_errorwhen system or socket operations fail
HueExceptionwhen response contained no body
HueAPIResponseExceptionwhen response contains an error
nlohmann::json::parse_errorwhen response could not be parsed

◆ setOn()

void hueplusplus::sensors::ZLLTemperature::setOn ( bool  on)

Enable or disable sensor.

Exceptions
std::system_errorwhen system or socket operations fail
HueExceptionwhen response contained no body
HueAPIResponseExceptionwhen response contains an error
nlohmann::json::parse_errorwhen response could not be parsed

Member Data Documentation

◆ typeStr

constexpr const char * hueplusplus::sensors::ZLLTemperature::typeStr = "ZLLTemperature"
static

ZLLTemperature sensor type name.


The documentation for this class was generated from the following files: