Sum of positive values fo my battery storage

Hi all,
after more than 12 month I have the first issue where I cannot find any solution online. I would like to see how much power was put into my Varta battery storage.

What I have: A sensor that is displaying the current power from and into the storage in W/h. How do I get the sum of the positive values only?

Use a template sensor to retrieve only the positive values. Feed that to a Riemann sum helper.

template:
  - sensor:
      - name: Battery Charge Power
        state_class: measurement 
        device_class: power
        unit_of_measurement: W
        state: "{{ 0 if states('sensor.your_sensor')|float(0) < 0 else states('sensor.your_sensor') }}"
        availability: "{{ has_value('sensor.your_sensor') }}"

When using the Riemann Sum helper make sure to use method: left

1 Like