Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic support for Hue Dynamic Scenes #8014

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16066,6 +16066,10 @@ int DeRestPlugin::handleHttpRequest(const QHttpRequestHeader &hdr, QTcpSocket *s
{
ret = d->handleScenesApi(req, rsp);
}
else if (apiModule == QLatin1String("hue-scenes"))
{
ret = d->handleHueScenesApi(req, rsp);
}
else if (apiModule == QLatin1String("sensors"))
{
ret = d->handleSensorsApi(req, rsp);
Expand Down
17 changes: 16 additions & 1 deletion de_web_plugin_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,8 @@ enum TaskType
TaskTuyaRequest = 41,
TaskXmasLightStrip = 42,
TaskSimpleMetering = 43,
TaskHueEffect = 44
TaskHueEffect = 44,
TaskHueManufacturerSpecific = 45
};

enum XmasLightStripMode
Expand Down Expand Up @@ -1058,6 +1059,11 @@ class DeRestPluginPrivate : public QObject
int modifyScene(const ApiRequest &req, ApiResponse &rsp);
int deleteScene(const ApiRequest &req, ApiResponse &rsp);

// REST API hue-scenes
int handleHueScenesApi(const ApiRequest &req, ApiResponse &rsp);
int playHueDynamicScene(const ApiRequest &req, ApiResponse &rsp);
int modifyHueScene(const ApiRequest &req, ApiResponse &rsp);

bool groupToMap(const ApiRequest &req, const Group *group, QVariantMap &map);

// REST API schedules
Expand Down Expand Up @@ -1432,9 +1438,18 @@ public Q_SLOTS:
// Advanced features of Hue lights.
QStringList getHueEffectNames(quint64 effectBitmap, bool colorloop);
QStringList getHueGradientStyleNames(quint16 styleBitmap);
bool isHueEffectLight(const LightNode *lightNode);
bool isMappableToManufacturerSpecific(const QVariantMap &map);
bool addTaskHueEffect(TaskItem &task, QString &effect);
bool validateHueGradient(const ApiRequest &req, ApiResponse &rsp, QVariantMap &gradient, quint16 styleBitmap);
bool addTaskHueGradient(TaskItem &task, QVariantMap &gradient);
bool validateHueLightState(ApiResponse &rsp, const LightNode *lightNode, QVariantMap &map, QList<QString> &validatedParameters);
bool validateHueDynamicScenePalette(ApiResponse &rsp, const Scene *scene, QVariantMap &map, QList<QString> &validatedParameters);
bool addTaskHueManufacturerSpecificSetState(TaskItem &task, const QVariantMap &items);
bool addTaskHueManufacturerSpecificAddScene(TaskItem &task, const quint16 groupId, const quint8 sceneId, const QVariantMap &items);
bool addTaskHueDynamicSceneRecall(TaskItem &task, const quint16 groupId, const quint8 sceneId, const QVariantMap &palette);
int setHueLightState(const ApiRequest &req, ApiResponse &rsp, TaskItem &taskRef, QVariantMap &map);
int setHueSceneLightState(const ApiRequest &req, ApiResponse &rsp, TaskItem &taskRef, QVariantMap &map);

// Merry Christmas!
bool isXmasLightStrip(const LightNode *lightNode);
Expand Down
Loading