Hi
I do use the following template to calculate my power usage in the house:
- sensor:
- name: “energie_hausverbrauch”
unit_of_measurement: “W”
state: “{{ states(‘sensor.solarnet_pv_leistung’) | float + states(‘sensor.wirkleistung_bezug_total’) | float - states(‘sensor.wirkleistung_lieferung_total’) | float }}”
- name: “energie_hausverbrauch”
So I talke the pv-production (sensor.solarnet_pv_leistung), add the consumption from grid (sensor.wirkleistung_bezug_total) minus delivering to grid (sensor.wirkleistung_lieferung_total)
Sometimes it gives me negative values, probably because one of the others is zero at this point?
How can I do that better?
Thanks; Lukas