|
hueplusplus 1.2.0
|
Class for Groups of lights. More...
#include <hueplusplus/Group.h>
Collaboration diagram for hueplusplus::Group:Public Member Functions | |
| Group (int id, const std::shared_ptr< APICache > &baseCache) | |
| Creates group with shared cache. | |
| Group (int id, const HueCommandAPI &commands, std::chrono::steady_clock::duration refreshDuration, const nlohmann::json ¤tState) | |
| Creates group with id. | |
| void | refresh (bool force=false) |
| Refreshes internal cached state. | |
| void | setRefreshDuration (std::chrono::steady_clock::duration refreshDuration) |
| Sets custom refresh interval for this group. | |
General information | |
| int | getId () const |
| Get the group id. | |
| std::string | getName () const |
| Get the group name. | |
| std::string | getType () const |
| Get the group type. | |
| std::vector< int > | getLightIds () const |
| Get lights in the group. | |
| void | setName (const std::string &name) |
| Set group name. | |
| void | setLights (const std::vector< int > &ids) |
| Set group lights. | |
| std::string | getRoomType () const |
| Get room type, only for type room. | |
| void | setRoomType (const std::string &type) |
| Set room type, only for type room. | |
| std::string | getModelId () const |
| Get luminaire model id, only for type luminaire. | |
| std::string | getUniqueId () const |
| Get luminaire model id, only for type luminaire or lightsource. | |
| bool | getAllOn () |
| Get whether all lights are on. | |
| bool | getAllOn () const |
| Get whether all lights are on. | |
| bool | getAnyOn () |
| Get whether any light is on. | |
| bool | getAnyOn () const |
| Get whether any light is on. | |
Query Action | |
The action is the state of one light in the group. It can be accessed using these methods. | |
| bool | getActionOn () |
| Get on state of one light in the group. | |
| bool | getActionOn () const |
| Get on state of one light in the group. | |
| std::pair< uint16_t, uint8_t > | getActionHueSaturation () |
| Get hue and saturation of one light in the group. | |
| std::pair< uint16_t, uint8_t > | getActionHueSaturation () const |
| Get hue and saturation of one light in the group. | |
| unsigned int | getActionBrightness () |
| Get brightness of one light in the group. | |
| unsigned int | getActionBrightness () const |
| Get brightness of one light in the group. | |
| unsigned int | getActionColorTemperature () |
| Get color temperature of one light in the group. | |
| unsigned int | getActionColorTemperature () const |
| Get color temperature of one light in the group. | |
| std::pair< float, float > | getActionColorXY () |
| Get color coordinates of one light in the group. | |
| std::pair< float, float > | getActionColorXY () const |
| Get color coordinates of one light in the group. | |
| std::string | getActionColorMode () |
| Get color mode of one light in the group. | |
| std::string | getActionColorMode () const |
| Get color mode of one light in the group. | |
Change lights | |
| StateTransaction | transaction () |
| Create a transaction for this group. | |
| void | setOn (bool on, uint8_t transition=4) |
| Convenience function to turn lights on. | |
| void | setBrightness (uint8_t brightness, uint8_t transition=4) |
| Convenience function to set brightness. | |
| void | setColor (const HueSaturation &hueSat, uint8_t transition=4) |
| Convenience function to set hue and saturation. | |
| void | setColor (const XYBrightness &xy, uint8_t transition=4) |
| Convenience function to set color xy. | |
| void | setColorTemperature (unsigned int mired, uint8_t transition=4) |
| Convenience function to set color temperature. | |
| void | setColorLoop (bool on, uint8_t transition=4) |
| Convenience function to set color loop. | |
| void | setScene (const std::string &scene) |
| Recall scene for the group. | |
| Action | createSceneAction (const std::string &scene) const |
| Get Action to set scene. | |
Protected Member Functions | |
| nlohmann::json | sendPutRequest (const std::string &subPath, const nlohmann::json &request, FileInfo fileInfo) |
| Utility function to send a put request to the group. | |
Protected Attributes | |
| int | id |
| APICache | state |
Class for Groups of lights.
Provides methods to control groups.
| hueplusplus::Group::Group | ( | int | id, |
| const std::shared_ptr< APICache > & | baseCache | ||
| ) |
Creates group with shared cache.
| id | Group id in the bridge |
| baseCache | Cache of the group list. |
| hueplusplus::Group::Group | ( | int | id, |
| const HueCommandAPI & | commands, | ||
| std::chrono::steady_clock::duration | refreshDuration, | ||
| const nlohmann::json & | currentState | ||
| ) |
Creates group with id.
| id | Group id in the bridge |
| commands | HueCommandAPI for requests |
| refreshDuration | Time between refreshing the cached state. |
| currentState | The current state, may be null. |
| Action hueplusplus::Group::createSceneAction | ( | const std::string & | scene | ) | const |
Get Action to set scene.
| scene | Scene name |
To set other light properties in a scene, use transaction().
| unsigned int hueplusplus::Group::getActionBrightness | ( | ) |
Get brightness of one light in the group.
| 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 |
| unsigned int hueplusplus::Group::getActionBrightness | ( | ) | const |
Get brightness of one light in the group.
| std::string hueplusplus::Group::getActionColorMode | ( | ) |
Get color mode of one light in the group.
The color mode is the currently used way to specify the color (hs,ct or xy).
| 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 |
| std::string hueplusplus::Group::getActionColorMode | ( | ) | const |
Get color mode of one light in the group.
The color mode is the currently used way to specify the color (hs,ct or xy).
| unsigned int hueplusplus::Group::getActionColorTemperature | ( | ) |
Get color temperature of one light in the group.
| 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 |
| unsigned int hueplusplus::Group::getActionColorTemperature | ( | ) | const |
Get color temperature of one light in the group.
| std::pair< float, float > hueplusplus::Group::getActionColorXY | ( | ) |
Get color coordinates of one light in the group.
| 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 |
| std::pair< float, float > hueplusplus::Group::getActionColorXY | ( | ) | const |
Get color coordinates of one light in the group.
| std::pair< uint16_t, uint8_t > hueplusplus::Group::getActionHueSaturation | ( | ) |
Get hue and saturation of one light in the group.
| 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 |
| std::pair< uint16_t, uint8_t > hueplusplus::Group::getActionHueSaturation | ( | ) | const |
Get hue and saturation of one light in the group.
| bool hueplusplus::Group::getActionOn | ( | ) |
Get on state of one light in the group.
| 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 |
| bool hueplusplus::Group::getActionOn | ( | ) | const |
Get on state of one light in the group.
| bool hueplusplus::Group::getAllOn | ( | ) |
Get whether all lights are on.
| 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 |
| bool hueplusplus::Group::getAllOn | ( | ) | const |
Get whether all lights are on.
| bool hueplusplus::Group::getAnyOn | ( | ) |
Get whether any light is on.
| 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 |
| bool hueplusplus::Group::getAnyOn | ( | ) | const |
Get whether any light is on.
| int hueplusplus::Group::getId | ( | ) | const |
Get the group id.
| std::vector< int > hueplusplus::Group::getLightIds | ( | ) | const |
Get lights in the group.
| std::string hueplusplus::Group::getModelId | ( | ) | const |
Get luminaire model id, only for type luminaire.
| std::string hueplusplus::Group::getName | ( | ) | const |
Get the group name.
| std::string hueplusplus::Group::getRoomType | ( | ) | const |
Get room type, only for type room.
| std::string hueplusplus::Group::getType | ( | ) | const |
Get the group type.
The type is specified on creation and cannot be changed.
Possible types:
0: Special group containing all lights, cannot be modified. Luminaire, Lightsource: Automatically created groups for multisource luminaires. LightGroup: Standard, user created group, not empty. Room: User created room, has room type. Entertainment: User created entertainment setup. Zone: User created Zone. | std::string hueplusplus::Group::getUniqueId | ( | ) | const |
Get luminaire model id, only for type luminaire or lightsource.
AA:BB:CC:DD format for luminaire groups or AA:BB:CC:DD-XX for Lightsource groups. | void hueplusplus::Group::refresh | ( | bool | force = false | ) |
Refreshes internal cached state.
| force | true forces a refresh, regardless of how long the last refresh was ago. false to only refresh when enough time has passed (needed e.g. when calling only const methods). |
| 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 |
|
protected |
Utility function to send a put request to the group.
| request | The request to send |
| subPath | A path that is appended to the uri, note it should always start with a slash ("/") |
| fileInfo | FileInfo from calling function for exception details. |
| 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::Group::setBrightness | ( | uint8_t | brightness, |
| uint8_t | transition = 4 |
||
| ) |
Convenience function to set brightness.
| void hueplusplus::Group::setColor | ( | const HueSaturation & | hueSat, |
| uint8_t | transition = 4 |
||
| ) |
Convenience function to set hue and saturation.
| void hueplusplus::Group::setColor | ( | const XYBrightness & | xy, |
| uint8_t | transition = 4 |
||
| ) |
Convenience function to set color xy.
| void hueplusplus::Group::setColorLoop | ( | bool | on, |
| uint8_t | transition = 4 |
||
| ) |
Convenience function to set color loop.
| void hueplusplus::Group::setColorTemperature | ( | unsigned int | mired, |
| uint8_t | transition = 4 |
||
| ) |
Convenience function to set color temperature.
| void hueplusplus::Group::setLights | ( | const std::vector< int > & | ids | ) |
Set group lights.
| ids | New light ids. May or may not be empty depending on type. |
| 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::Group::setName | ( | const std::string & | name | ) |
Set group name.
| name | New name for the group. Must be unique for all groups, otherwise a number is added. |
| void hueplusplus::Group::setOn | ( | bool | on, |
| uint8_t | transition = 4 |
||
| ) |
Convenience function to turn lights on.
| void hueplusplus::Group::setRefreshDuration | ( | std::chrono::steady_clock::duration | refreshDuration | ) |
Sets custom refresh interval for this group.
| refreshDuration | The new minimum duration between refreshes. May be 0 or c_refreshNever. |
| void hueplusplus::Group::setRoomType | ( | const std::string & | type | ) |
Set room type, only for type room.
| type | New room class, case sensitive. Only specific values are allowed. |
| 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::Group::setScene | ( | const std::string & | scene | ) |
Recall scene for the group.
Scenes are saved configurations for the lights in a group.
| scene | Scene name. |
| StateTransaction hueplusplus::Group::transaction | ( | ) |
Create a transaction for this group.
The transaction can be used to change more than one value in one request.
Example usage:
|
protected |
|
protected |