mirror of
https://github.com/nymea/nymea-plugins.git
synced 2026-07-15 00:22:26 +02:00
some more work
This commit is contained in:
parent
3985f2ad5a
commit
d14e5334e4
@ -163,6 +163,9 @@ void IntegrationPluginOwlet::setupThing(ThingSetupInfo *info)
|
||||
if (params.contains("color")) {
|
||||
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>();
|
||||
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);
|
||||
connect(client, &OwletClient::replyReceived, info, [=](int commandId, const QVariantMap ¶ms){
|
||||
@ -229,6 +236,8 @@ void IntegrationPluginOwlet::executeAction(ThingActionInfo *info)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Q_ASSERT_X(false, "IntegrationPluginOwlet", "Not implemented");
|
||||
info->finish(Thing::ThingErrorUnsupportedFeature);
|
||||
}
|
||||
|
||||
@ -207,6 +207,16 @@
|
||||
"maxValue": 100,
|
||||
"defaultValue": 50,
|
||||
"writable": true
|
||||
},
|
||||
{
|
||||
"id": "cb90f7bf-bcb0-42e8-a03b-442d84c5871f",
|
||||
"name": "effect",
|
||||
"displayName": "Effect",
|
||||
"displayNameEvent": "Effect changed",
|
||||
"displayNameAction": "Set effect",
|
||||
"type": "int",
|
||||
"defaultValue": 0,
|
||||
"writable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user