23 #ifndef INCLUDE_HUEPLUSPLUS_GROUP_H 24 #define INCLUDE_HUEPLUSPLUS_GROUP_H 34 #include "json/json.hpp" 47 Group(
int id,
const std::shared_ptr<APICache>& baseCache);
53 Group(
int id,
const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration,
const nlohmann::json& currentState);
62 void refresh(
bool force =
false);
97 void setName(
const std::string& name);
104 void setLights(
const std::vector<int>& ids);
255 void setOn(
bool on, uint8_t transition = 4);
258 void setBrightness(uint8_t brightness, uint8_t transition = 4);
276 void setScene(
const std::string& scene);
298 nlohmann::json
sendPutRequest(
const std::string& subPath,
const nlohmann::json& request,
FileInfo fileInfo);
318 static CreateGroup LightGroup(
const std::vector<int>& lights,
const std::string& name =
"");
327 const std::vector<int>& lights,
const std::string& name =
"",
const std::string& roomType =
"");
334 static CreateGroup Entertainment(
const std::vector<int>& lights,
const std::string& name =
"");
341 static CreateGroup Zone(
const std::vector<int>& lights,
const std::string& name =
"");
345 nlohmann::json getRequest()
const;
354 const std::vector<int>& lights,
const std::string& name,
const std::string& type,
const std::string& roomType);
357 std::vector<int> lights;
360 std::string roomType;
int getId() const
Get the group id.
Definition: Group.cpp:36
StateTransaction transaction()
Create a transaction for this group.
Definition: Group.cpp:163
Parameters necessary for creating a new Group.
Definition: Group.h:310
void setColor(const HueSaturation &hueSat, uint8_t transition=4)
Convenience function to set hue and saturation.
Definition: Group.cpp:179
Definition: HueCommandAPI.h:37
void setName(const std::string &name)
Set group name.
Definition: Group.cpp:67
Action executed by the bridge, e.g. as a Schedule command.
Definition: Action.h:35
Namespace for the hueplusplus library.
Definition: Action.h:27
Action createSceneAction(const std::string &scene) const
Get Action to set scene.
Definition: Group.cpp:204
Group(int id, const std::shared_ptr< APICache > &baseCache)
Creates group with shared cache.
Definition: Group.cpp:7
void setRefreshDuration(std::chrono::steady_clock::duration refreshDuration)
Sets custom refresh interval for this group.
Definition: Group.cpp:30
Caches API GET requests and refreshes regularly.
Definition: APICache.h:37
void setOn(bool on, uint8_t transition=4)
Convenience function to turn lights on.
Definition: Group.cpp:169
void setScene(const std::string &scene)
Recall scene for the group.
Definition: Group.cpp:199
void refresh(bool force=false)
Refreshes internal cached state.
Definition: Group.cpp:18
std::string getType() const
Get the group type.
Definition: Group.cpp:46
void setRoomType(const std::string &type)
Set room type, only for type room.
Definition: Group.cpp:222
bool getActionOn()
Get on state of one light in the group.
Definition: Group.cpp:103
Contains information about error location, use CURRENT_FILE_INFO to create.
Definition: HueException.h:34
std::string getRoomType() const
Get room type, only for type room.
Definition: Group.cpp:217
void setLights(const std::vector< int > &ids)
Set group lights.
Definition: Group.cpp:74
void setBrightness(uint8_t brightness, uint8_t transition=4)
Convenience function to set brightness.
Definition: Group.cpp:174
bool getAllOn()
Get whether all lights are on.
Definition: Group.cpp:85
Color and brightness in CIE.
Definition: ColorUnits.h:62
unsigned int getActionBrightness()
Get brightness of one light in the group.
Definition: Group.cpp:125
std::pair< uint16_t, uint8_t > getActionHueSaturation()
Get hue and saturation of one light in the group.
Definition: Group.cpp:112
void setColorLoop(bool on, uint8_t transition=4)
Convenience function to set color loop.
Definition: Group.cpp:194
std::string getName() const
Get the group name.
Definition: Group.cpp:41
bool getAnyOn()
Get whether any light is on.
Definition: Group.cpp:94
Transaction class which can be used for either light or group state.
Definition: StateTransaction.h:61
int id
Definition: Group.h:301
std::pair< float, float > getActionColorXY()
Get color coordinates of one light in the group.
Definition: Group.cpp:143
void setColorTemperature(unsigned int mired, uint8_t transition=4)
Convenience function to set color temperature.
Definition: Group.cpp:189
std::vector< int > getLightIds() const
Get lights in the group.
Definition: Group.cpp:51
nlohmann::json sendPutRequest(const std::string &subPath, const nlohmann::json &request, FileInfo fileInfo)
Utility function to send a put request to the group.
Definition: Group.cpp:212
Class for Groups of lights.
Definition: Group.h:41
std::string getUniqueId() const
Get luminaire model id, only for type luminaire or lightsource.
Definition: Group.cpp:233
APICache state
Definition: Group.h:302
Color in hue and saturation.
Definition: ColorUnits.h:31
unsigned int getActionColorTemperature()
Get color temperature of one light in the group.
Definition: Group.cpp:134
std::string getModelId() const
Get luminaire model id, only for type luminaire.
Definition: Group.cpp:228
std::string getActionColorMode()
Get color mode of one light in the group.
Definition: Group.cpp:154