From 2fe97975fef3e8107e2e76e7814247ba82b3cd81 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 31 Jul 2020 13:09:51 +0200 Subject: [PATCH] Shelly: Allow setting the roller shutter percentage --- shelly/integrationpluginshelly.cpp | 9 +++++++++ shelly/integrationpluginshelly.json | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/shelly/integrationpluginshelly.cpp b/shelly/integrationpluginshelly.cpp index 824ce060..4d0132cb 100644 --- a/shelly/integrationpluginshelly.cpp +++ b/shelly/integrationpluginshelly.cpp @@ -414,6 +414,15 @@ void IntegrationPluginShelly::executeAction(ThingActionInfo *info) return; } + if (action.actionTypeId() == shellyRollerPercentageActionTypeId) { + Thing *parentDevice = myThings().findById(thing->parentId()); + MqttChannel *channel = m_mqttChannels.value(parentDevice); + QString shellyId = parentDevice->paramValue(m_idParamTypeMap.value(parentDevice->thingClassId())).toString(); + channel->publish("shellies/" + shellyId + "/roller/0/command/pos", QByteArray::number(action.param(shellyRollerPercentageActionPercentageParamTypeId).value().toInt())); + info->finish(Thing::ThingErrorNoError); + return; + } + qCWarning(dcShelly()) << "Unhandled execute action call for device" << thing; } diff --git a/shelly/integrationpluginshelly.json b/shelly/integrationpluginshelly.json index 83160a1d..c0ffa023 100644 --- a/shelly/integrationpluginshelly.json +++ b/shelly/integrationpluginshelly.json @@ -901,8 +901,12 @@ "name": "percentage", "displayName": "Position", "displayNameEvent": "Position changed", + "displayNameAction": "Set position", "type": "int", - "defaultValue": 0 + "defaultValue": 0, + "minValue": 0, + "maxValue": 100, + "writable": true } ], "actionTypes": [