Closed Roving-Ronin closed 1 week ago
Hi The logic is as follows:
const battenergy = this.getEntity('battery.energy', {state: config.battery.energy?.toString() ?? ''});
let batteryEnergy = battenergy.toPower(false);
if (batteryVoltage && stateBatteryRatedCapacity.notEmpty()) {
batteryEnergy = Utils.toNum(batteryVoltage * stateBatteryRatedCapacity.toNum(0), 0)
}
The battery_rated_capacity:
sensor should provide a value in Ah. If defined together with battery voltage it calculates battery energy by multiplying the two.
@Roving-Ronin have you had a chance to confirm this. If you provide a sensor for battery_rated_capacity: the battery energy will be calculated as
battery_rated_capacity x battery_voltage_183
@slipx06 No sorry been busy with family / away.... will revert to you on this (and the current Power Load / Daily KWh for the whole house thing).
Closing this as intended logic
Is there an existing issue for this?
Current Behavior
In the visual editor there is two locations that the batteries rated capacity can be set using a sensor:
1) Battery Options ---> Optional Sensors (where a sensor can be used instead of a hard coded number) ---> Energy. That in the yaml is stored as:
2) In Entities ---> Battery Entities ---> battery_rated_capacity (that allows selecting a sensor to provide the value also). This is stored in the yaml as:
I've found that if both of these options are filled in, even with the same sensor, it means you end up with two locations specifying essentially the same thing. Checking the documentation it states "Battery rated capacity (Ah). If provided this sensor will be used to calculate battery energy. The energy attribute under the battery card configuration will be ignored.". However instead of ignoring the first entry (energy) what is happening is that the batteries capacity (or charge in kWh held at that moment) is being halved (i.e. 10kWh is shown as 5kWh etc).
Note: For Huawei / iStore the custom sensor.batteries.rated_capacity has a value of 10 kWh (that is dynamically calculated from the battery modules installed and their diagnostic reporting of their total sizes)
Steps To Reproduce
As per above description enter your sensor containing batteries rated capacity at the two points in the visual editor
Expected behaviour
kWh held, as shown under the battery will be 50% of what it actually is.
Card Version
v4.39.0 (was occurring on earlier also)
Home Assistant Version
Core: 2024.5.2/ Supervisor: 2024.05.1 / OS: 12.3
Configuration
Relevant log output
No response