Keba: Set energy live states to 0 if not connected

master
Simon Stürz 2023-02-02 00:44:50 +01:00
parent 2d6125f6ef
commit f5daf98896
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);