In order to be able to easily change the source sensor of the “battery” in the future without breaking the energy dashboard history, I created a “battery_charged” sensor based on the original one :“battery_total_charge”.
Unfortunately it happens that sometimes the “fake” sensor reports wrong values, in the following example the original at 10:20 reads 26.5 (kWh), while the fake one 19.9. Except then go back to the right measurement, damaging the energy dashboard.
I attached the plotted graphics of both sensor in Grafana and the tables.
Does anyone know why? did I set the fake sensor wrong?
Thanks!
"Fake sensor"
- name: battery_charged
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
state: >
{{ (states('sensor.battery_total_charge')|float(0) ) }}
which is based on sensor.battery_total_charge
Original sensor details
state_class: total
unit_of_measurement: kWh
device_class: energy
icon: mdi:battery-plus-variant
friendly_name: Battery Total charge