mystrom: Set current power to 0 if not connected
parent
bc059d4efd
commit
aa64d9f565
|
|
@ -148,7 +148,7 @@ void IntegrationPluginMyStrom::setupThing(ThingSetupInfo *info)
|
||||||
}
|
}
|
||||||
info->finish(Thing::ThingErrorNoError);
|
info->finish(Thing::ThingErrorNoError);
|
||||||
|
|
||||||
info->thing()->setStateValue("connected", true);
|
info->thing()->setStateValue(switchConnectedStateTypeId, true);
|
||||||
|
|
||||||
pluginStorage()->beginGroup(info->thing()->id().toString());
|
pluginStorage()->beginGroup(info->thing()->id().toString());
|
||||||
pluginStorage()->setValue("cachedAddress", infoUrl.host());
|
pluginStorage()->setValue("cachedAddress", infoUrl.host());
|
||||||
|
|
@ -171,6 +171,7 @@ void IntegrationPluginMyStrom::postSetupThing(Thing *thing)
|
||||||
if (reply->error() != QNetworkReply::NoError) {
|
if (reply->error() != QNetworkReply::NoError) {
|
||||||
qCWarning(dcMyStrom()) << "Error fetching report from myStrom device:" << reply->errorString();
|
qCWarning(dcMyStrom()) << "Error fetching report from myStrom device:" << reply->errorString();
|
||||||
thing->setStateValue(switchConnectedStateTypeId, false);
|
thing->setStateValue(switchConnectedStateTypeId, false);
|
||||||
|
thing->setStateValue(switchCurrentPowerStateTypeId, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QByteArray data = reply->readAll();
|
QByteArray data = reply->readAll();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue