some more work

This commit is contained in:
Michael Zanetti 2021-10-17 13:03:29 +02:00
parent 3985f2ad5a
commit d14e5334e4
2 changed files with 19 additions and 0 deletions

View File

@ -163,6 +163,9 @@ void IntegrationPluginOwlet::setupThing(ThingSetupInfo *info)
if (params.contains("color")) { if (params.contains("color")) {
thing->setStateValue(ws2812ColorStateTypeId, params.value("color").value<QColor>()); thing->setStateValue(ws2812ColorStateTypeId, params.value("color").value<QColor>());
} }
if (params.contains("effect")) {
thing->setStateValue(ws2812EffectStateTypeId, params.value("effect").toInt());
}
} }
} }
}); });
@ -212,6 +215,10 @@ void IntegrationPluginOwlet::executeAction(ThingActionInfo *info)
QColor color = info->action().paramValue(ws2812ColorActionColorParamTypeId).value<QColor>(); QColor color = info->action().paramValue(ws2812ColorActionColorParamTypeId).value<QColor>();
params.insert("color", (color.rgb() & 0xFFFFFF)); params.insert("color", (color.rgb() & 0xFFFFFF));
} }
if (info->action().actionTypeId() == ws2812EffectActionTypeId) {
int effect = info->action().paramValue(ws2812EffectActionEffectParamTypeId).toInt();
params.insert("effect", effect);
}
int id = client->sendCommand("GPIO.ControlPin", params); int id = client->sendCommand("GPIO.ControlPin", params);
connect(client, &OwletClient::replyReceived, info, [=](int commandId, const QVariantMap &params){ connect(client, &OwletClient::replyReceived, info, [=](int commandId, const QVariantMap &params){
@ -229,6 +236,8 @@ void IntegrationPluginOwlet::executeAction(ThingActionInfo *info)
return; return;
} }
Q_ASSERT_X(false, "IntegrationPluginOwlet", "Not implemented"); Q_ASSERT_X(false, "IntegrationPluginOwlet", "Not implemented");
info->finish(Thing::ThingErrorUnsupportedFeature); info->finish(Thing::ThingErrorUnsupportedFeature);
} }

View File

@ -207,6 +207,16 @@
"maxValue": 100, "maxValue": 100,
"defaultValue": 50, "defaultValue": 50,
"writable": true "writable": true
},
{
"id": "cb90f7bf-bcb0-42e8-a03b-442d84c5871f",
"name": "effect",
"displayName": "Effect",
"displayNameEvent": "Effect changed",
"displayNameAction": "Set effect",
"type": "int",
"defaultValue": 0,
"writable": true
} }
] ]
} }