Another "Energy Dashboard showing no data" post

I have tried working with the energy dashboard multiple times. I thought I had this time, but after leaving the new sensors on the dashboard overnight there is still no data. I have three sensors which are total accumulations in Kwh.

In my template.yaml

- sensor:
    - name: total_power_consumed
      unit_of_measurement: "kWh"
      state_class: measurement
      device_class: energy
      state: >
        {% set battery_consumed = state_attr('sensor.victron_power_data', 'Bc') | float(0) %}
        {% set solar_consumed = state_attr('sensor.victron_power_data', 'Pc') | float(0) %}
        {% set generator_consumed = state_attr('sensor.victron_power_data', 'gc') | float(0) %}
        {{ float(battery_consumed) + float(solar_consumed) + float(generator_consumed) }}
      attributes:
        last_reset: '1970-01-01T00:00:00+00:00'
    - name: total_generator_used
      unit_of_measurement: "kWh"
      state_class: measurement
      device_class: energy
      state: >
        {% set to_battery = state_attr('sensor.victron_power_data', 'gb') | float(0) %}
        {% set direct = state_attr('sensor.victron_power_data', 'gc') | float(0) %}
        {{ float(to_battery) + float(direct) }}
      attributes:
        last_reset: '1970-01-01T00:00:00+00:00'
    - name: total_solar_produced
      unit_of_measurement: "kWh"
      state_class: measurement
      device_class: energy
      state: >
        {% set to_battery = state_attr('sensor.victron_power_data', 'Pb') | float(0) %}
        {% set direct = state_attr('sensor.victron_power_data', 'Pc') | float(0) %}
        {{ float(to_battery) + float(direct) }}
      attributes:
        last_reset: '1970-01-01T00:00:00+00:00'
    - name: total_battery_consumption
      unit_of_measurement: "kWh"
      state_class: measurement
      device_class: energy
      state: >
        {{ state_attr('sensor.victron_power_data', 'Bc') | float(0) }}
      attributes:
        last_reset: '1970-01-01T00:00:00+00:00'
    - name: total_to_battery
      unit_of_measurement: "kWh"
      state_class: measurement
      device_class: energy
      state: >
        {% set solar_to_battery = state_attr('sensor.victron_power_data', 'Pb') | float(0) %}
        {% set gen_to_battery = state_attr('sensor.victron_power_data', 'gb') | float(0) %}
        {{ float(solar_to_battery) + float(gen_to_battery) }}
      attributes:
        last_reset: '1970-01-01T00:00:00+00:00'

States for those sensors:

Energy Dashboard Config:

Energy Dashboard (has been live for 6+ hours):

What am I doing wrong?

That should be state_class: total_increasing or total.

2 Likes

@tom_l who are you?! How are you so fast and always available and always right!!!

2 Likes

Oh, if only that were true. :slight_smile: