Hello all, I would like to count the kwh that I feed into the grid. unfortunately, my meter has a stop therefore this must go through a template sensor and the current power (W). That means if the watt goes into minus the kwh should be counted. My experience is currently very limited maybe someone can help me
- name: Power to Grid
unique_id: power_to_grid
icon: mdi:transmission-tower-export
state_class: measurement
device_class: energy
unit_of_measurement: kWh
state: if (sensor.tasmota_haus_power_curr < 0,
sensor.tasmota_haus_power_curr * -1, 0)
and hereafter should be counted to kWh but there I currently have no idea how that should work because the power is not permanentl recorded