Merge PR #656: Keba: Set energy live states to 0 if not connected

master
jenkins 2023-03-07 19:21:27 +01:00
commit 25860c3311
1 changed files with 10 additions and 0 deletions

View File

@ -333,6 +333,16 @@ void IntegrationPluginKeba::setupKeba(ThingSetupInfo *info, const QHostAddress &
KeContact *keba = new KeContact(address, m_kebaDataLayer, this);
connect(keba, &KeContact::reachableChanged, thing, [=](bool reachable){
thing->setStateValue("connected", reachable);
if (!reachable) {
thing->setStateValue("voltagePhaseA", 0);
thing->setStateValue("voltagePhaseB", 0);
thing->setStateValue("voltagePhaseC", 0);
thing->setStateValue("currentPhaseA", 0);
thing->setStateValue("currentPhaseB", 0);
thing->setStateValue("currentPhaseC", 0);
thing->setStateValue("currentPower", 0);
thing->setStateValue("powerFactor", 0);
}
});
connect(keba, &KeContact::commandExecuted, this, &IntegrationPluginKeba::onCommandExecuted);