Update battery charging state and remove from meter due to strange data
parent
2a19b033ab
commit
66aa5e0edd
|
|
@ -406,7 +406,7 @@ void IntegrationPluginKostal::setupKostalConnection(ThingSetupInfo *info)
|
||||||
thing->setStateValue(kostalInverterTotalEnergyProducedStateTypeId, kostalConnection->totalYield() / 1000.0); // kWh
|
thing->setStateValue(kostalInverterTotalEnergyProducedStateTypeId, kostalConnection->totalYield() / 1000.0); // kWh
|
||||||
|
|
||||||
// Power
|
// Power
|
||||||
thing->setStateValue(kostalInverterCurrentPowerStateTypeId, - kostalConnection->totalAcPower());
|
thing->setStateValue(kostalInverterCurrentPowerStateTypeId, - (kostalConnection->totalAcPower() - kostalConnection->batteryActualPower()));
|
||||||
|
|
||||||
// Update the battery if available
|
// Update the battery if available
|
||||||
Things batteryThings = myThings().filterByParentId(thing->id()).filterByThingClassId(kostalBatteryThingClassId);
|
Things batteryThings = myThings().filterByParentId(thing->id()).filterByThingClassId(kostalBatteryThingClassId);
|
||||||
|
|
@ -425,9 +425,9 @@ void IntegrationPluginKostal::setupKostalConnection(ThingSetupInfo *info)
|
||||||
batteryThing->setStateValue(kostalBatteryCurrentPowerStateTypeId, batteryPower);
|
batteryThing->setStateValue(kostalBatteryCurrentPowerStateTypeId, batteryPower);
|
||||||
if (batteryPower == 0) {
|
if (batteryPower == 0) {
|
||||||
batteryThing->setStateValue(kostalBatteryChargingStateStateTypeId, "idle");
|
batteryThing->setStateValue(kostalBatteryChargingStateStateTypeId, "idle");
|
||||||
} else if (batteryPower > 0) {
|
|
||||||
batteryThing->setStateValue(kostalBatteryChargingStateStateTypeId, "discharging");
|
|
||||||
} else if (batteryPower < 0) {
|
} else if (batteryPower < 0) {
|
||||||
|
batteryThing->setStateValue(kostalBatteryChargingStateStateTypeId, "discharging");
|
||||||
|
} else if (batteryPower > 0) {
|
||||||
batteryThing->setStateValue(kostalBatteryChargingStateStateTypeId, "charging");
|
batteryThing->setStateValue(kostalBatteryChargingStateStateTypeId, "charging");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue