battery critical only when not charging

This commit is contained in:
Boernsman 2021-01-19 09:44:42 +01:00
parent cdff51655f
commit 7e1df2a3e1

View File

@ -84,7 +84,11 @@ void FroniusStorage::updateThingInfo(const QByteArray &data)
// copy retrieved information to thing states // copy retrieved information to thing states
if (storageInfoMap.contains("StateOfCharge_Relative")) { if (storageInfoMap.contains("StateOfCharge_Relative")) {
pluginThing()->setStateValue(storageBatteryLevelStateTypeId, storageInfoMap.value("StateOfCharge_Relative").toInt()); 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")) if (storageInfoMap.contains("Temperature_Cell"))