From aa64d9f565704c5d51111f49878c16d15e751989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Thu, 2 Feb 2023 00:50:15 +0100 Subject: [PATCH] mystrom: Set current power to 0 if not connected --- mystrom/integrationpluginmystrom.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mystrom/integrationpluginmystrom.cpp b/mystrom/integrationpluginmystrom.cpp index cf2e0710..6ac536b3 100644 --- a/mystrom/integrationpluginmystrom.cpp +++ b/mystrom/integrationpluginmystrom.cpp @@ -148,7 +148,7 @@ void IntegrationPluginMyStrom::setupThing(ThingSetupInfo *info) } info->finish(Thing::ThingErrorNoError); - info->thing()->setStateValue("connected", true); + info->thing()->setStateValue(switchConnectedStateTypeId, true); pluginStorage()->beginGroup(info->thing()->id().toString()); pluginStorage()->setValue("cachedAddress", infoUrl.host()); @@ -171,6 +171,7 @@ void IntegrationPluginMyStrom::postSetupThing(Thing *thing) if (reply->error() != QNetworkReply::NoError) { qCWarning(dcMyStrom()) << "Error fetching report from myStrom device:" << reply->errorString(); thing->setStateValue(switchConnectedStateTypeId, false); + thing->setStateValue(switchCurrentPowerStateTypeId, 0); return; } QByteArray data = reply->readAll();