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