ESPSomfyRTS: Fix step up/down for blinds

This commit is contained in:
Simon Stürz 2026-07-13 20:18:16 +02:00
parent 8df1303074
commit 2dc23aef77
2 changed files with 20 additions and 1 deletions

View File

@ -205,8 +205,10 @@ void IntegrationPluginEspSomfyRts::executeAction(ThingActionInfo *info)
}
QNetworkRequest request(somfy->shadeCommandUrl());
const QByteArray requestData = QJsonDocument::fromVariant(requestMap).toJson();
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QNetworkReply *reply = hardwareManager()->networkManager()->put(request, QJsonDocument::fromVariant(requestMap).toJson());
qCDebug(dcESPSomfyRTS()) << "Executing command on" << info->thing() << qUtf8Printable(requestData);
QNetworkReply *reply = hardwareManager()->networkManager()->put(request, requestData);
connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater);
connect(reply, &QNetworkReply::finished, info, [reply, info](){
@ -260,6 +262,12 @@ void IntegrationPluginEspSomfyRts::executeAction(ThingActionInfo *info)
int percentage = calculatePercentageFromAngle(minValue, maxValue, angle);
qCDebug(dcESPSomfyRTS()) << "######" << percentage;
requestMap.insert("target", percentage);
} else if (action.actionTypeId() == venetianBlindStepUpActionTypeId) {
requestMap.insert("command", EspSomfyRts::getShadeCommandString(EspSomfyRts::ShadeCommandStepUp));
requestMap.insert("stepSize", thing->setting(venetianBlindSettingsStepSizeParamTypeId).toUInt());
} else if (action.actionTypeId() == venetianBlindStepDownActionTypeId) {
requestMap.insert("command", EspSomfyRts::getShadeCommandString(EspSomfyRts::ShadeCommandStepDown));
requestMap.insert("stepSize", thing->setting(venetianBlindSettingsStepSizeParamTypeId).toUInt());
}
QNetworkRequest request(url);

View File

@ -157,6 +157,17 @@
"type": "uint"
}
],
"settingsTypes": [
{
"id": "ad505c57-6029-40a8-a610-f909e1f61f06",
"name": "stepSize",
"displayName": "Step size",
"type": "uint",
"defaultValue": 1,
"minValue": 1,
"maxValue": 127
}
],
"stateTypes": [
{
"id": "ade34009-bb6c-41fc-86dc-fc59c9cbca2f",