From 3e130a602f19a7b172a92b28f9f655b3bad86bfc Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 18 Mar 2022 00:48:22 +0100 Subject: [PATCH] Fix shelly switch settings --- shelly/integrationpluginshelly.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shelly/integrationpluginshelly.cpp b/shelly/integrationpluginshelly.cpp index 35fee339..384b4285 100644 --- a/shelly/integrationpluginshelly.cpp +++ b/shelly/integrationpluginshelly.cpp @@ -114,6 +114,7 @@ static QHash connectedDevice2ParamTypeMap = { }; static QHash channelParamTypeMap = { + {shellySwitchThingClassId, shellySwitchThingChannelParamTypeId}, {shellyGenericThingClassId, shellyGenericThingChannelParamTypeId}, {shellyLightThingClassId, shellyLightThingChannelParamTypeId}, {shellySocketThingClassId, shellySocketThingChannelParamTypeId}, @@ -1519,7 +1520,7 @@ void IntegrationPluginShelly::setupShellyChild(ThingSetupInfo *info) url.setScheme("http"); url.setHost(address); url.setPort(80); - url.setPath(QString("/settings/relay/%1").arg(thing->paramValue(channelParamTypeMap.value(thing->thingClassId())).toInt() + 1)); + url.setPath(QString("/settings/relay/%0").arg(thing->paramValue(channelParamTypeMap.value(thing->thingClassId())).toInt() - 1)); url.setUserName(parentDevice->paramValue(usernameParamTypeMap.value(parentDevice->thingClassId())).toString()); url.setPassword(parentDevice->paramValue(passwordParamTypeMap.value(parentDevice->thingClassId())).toString()); @@ -1536,6 +1537,8 @@ void IntegrationPluginShelly::setupShellyChild(ThingSetupInfo *info) url.setQuery(query); + qCDebug(dcShelly) << "Setting configuration:" << url.toString(); + QNetworkReply *reply = hardwareManager()->networkManager()->get(QNetworkRequest(url)); connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater); });