Energy Dashboard: Provide battery information

Hi

I am new to the energy dashboard, want to giving it a try.
One of my batteries (Varta Element 6) can be read via modbus and provices the active power reading. If the value is positive is charging, if negative is discharging. I used the Rieman-Sum Integration to calculate the energy now (with Utility Meter daily resetted) - however, how do I feed that to the energy dashboard?

The dashboard seems to expect an entity for energy going into the storage and one for going out. I have no clue how to have that constructed from the Utility Meter Integration which is feed by the Rieman sum… :confused:

If nobody else has a brainwave, I could only imagine to have two template sensors, once where I add the value when the input is positive (charge) and to the other when its negative (discharge). Stupid? Good?

Did it now as described. Used two template sensor. One accepts positive values and other negativ values (making them positiv of cause), then use these as input for two riemann integrations and finally utility meter integrations. Now I can feed the data to the dashboard. A drag, but it works.

Would be great if the energy dashboard could directly use that acitve power values in the future.

2 Likes

Could you please share details? I am facing the same problem with my battery charge / discharge status. How did you configure the template sensors? Thanks.

1 Like
  - platform: template
    sensors:
      battery_power_charging:
        friendly_name: "Battery Power Charging"
        unique_id: 6ef010c8-ed1d-11ed-a05b-0242ac120003
        unit_of_measurement: "W"
        device_class: power
        value_template: "{{ max(0, 0 - states('sensor.battery_power') | float(default=0)) }}"
      battery_power_discharging:
        friendly_name: "Battery Power Discharging"
        unique_id: 89a1fe18-ed1d-11ed-a05b-0242ac120003
        unit_of_measurement: "W"
        device_class: power
        value_template: "{{ max(0, states('sensor.battery_power') | float(default=0)) }}"
  - platform: integration
    source: sensor.battery_power_charging
    unique_id: 1a757c24-ed25-11ed-a05b-0242ac120003
    name: battery_energy_charging
    unit_prefix: k
    round: 2
  - platform: integration
    source: sensor.battery_power_discharging
    unique_id: 66a58a12-ed25-11ed-a05b-0242ac120003
    name: battery_energy_discharging
    unit_prefix: k
    round: 2