Merge PR #378: Fronius: Storage battery critical only when not charging

master
Jenkins nymea 2021-02-26 10:27:55 +01:00
commit 5430f2a83d
1 changed files with 5 additions and 1 deletions

View File

@ -84,7 +84,11 @@ void FroniusStorage::updateThingInfo(const QByteArray &data)
// copy retrieved information to thing states
if (storageInfoMap.contains("StateOfCharge_Relative")) {
pluginThing()->setStateValue(storageBatteryLevelStateTypeId, storageInfoMap.value("StateOfCharge_Relative").toInt());
pluginThing()->setStateValue(storageBatteryCriticalStateTypeId, storageInfoMap.value("StateOfCharge_Relative").toInt() < 5);
if ((pluginThing()->stateValue(storageChargingStateTypeId) != "charging") && (storageInfoMap.value("StateOfCharge_Relative").toInt() < 5)) {
pluginThing()->setStateValue(storageBatteryCriticalStateTypeId, true);
} else {
pluginThing()->setStateValue(storageBatteryCriticalStateTypeId, false);
}
}
if (storageInfoMap.contains("Temperature_Cell"))