Shelly: Allow setting the roller shutter percentage

master
Michael Zanetti 2020-07-31 13:09:51 +02:00
parent d05f21d4c7
commit 2fe97975fe
2 changed files with 14 additions and 1 deletions

View File

@ -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;
}

View File

@ -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": [