Skip to content

Commit

Permalink
some more work
Browse files Browse the repository at this point in the history
  • Loading branch information
mzanetti committed Oct 17, 2021
1 parent 780ada7 commit 471bfb0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions owlet/integrationpluginowlet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
});
Expand Down Expand Up @@ -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 &params){
Expand All @@ -229,6 +236,8 @@ void IntegrationPluginOwlet::executeAction(ThingActionInfo *info)
return;
}



Q_ASSERT_X(false, "IntegrationPluginOwlet", "Not implemented");
info->finish(Thing::ThingErrorUnsupportedFeature);
}
Expand Down
10 changes: 10 additions & 0 deletions owlet/integrationpluginowlet.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
Expand Down

0 comments on commit 471bfb0

Please sign in to comment.