Update battery charging state and remove from meter due to strange data

pull/56/head
Simon Stürz 2022-08-24 17:04:42 +02:00
parent 2a19b033ab
commit 66aa5e0edd
1 changed files with 3 additions and 3 deletions

View File

@ -406,7 +406,7 @@ void IntegrationPluginKostal::setupKostalConnection(ThingSetupInfo *info)
thing->setStateValue(kostalInverterTotalEnergyProducedStateTypeId, kostalConnection->totalYield() / 1000.0); // kWh
// Power
thing->setStateValue(kostalInverterCurrentPowerStateTypeId, - kostalConnection->totalAcPower());
thing->setStateValue(kostalInverterCurrentPowerStateTypeId, - (kostalConnection->totalAcPower() - kostalConnection->batteryActualPower()));
// Update the battery if available
Things batteryThings = myThings().filterByParentId(thing->id()).filterByThingClassId(kostalBatteryThingClassId);
@ -425,9 +425,9 @@ void IntegrationPluginKostal::setupKostalConnection(ThingSetupInfo *info)
batteryThing->setStateValue(kostalBatteryCurrentPowerStateTypeId, batteryPower);
if (batteryPower == 0) {
batteryThing->setStateValue(kostalBatteryChargingStateStateTypeId, "idle");
} else if (batteryPower > 0) {
batteryThing->setStateValue(kostalBatteryChargingStateStateTypeId, "discharging");
} else if (batteryPower < 0) {
batteryThing->setStateValue(kostalBatteryChargingStateStateTypeId, "discharging");
} else if (batteryPower > 0) {
batteryThing->setStateValue(kostalBatteryChargingStateStateTypeId, "charging");
}
}