Help with Energy integration following upgrade to 2022.3.8

Hi

I had a fully working energy dashboard using the new energy integration however having upgraded to 2022.3.8 I’m having issues with the integration displaying or processing any data

Originally my sensor (which gives the kWh reading over mqtt) worked fine with this code:

 - platform: mqtt
    name: "Day Energy Smart"
    unique_id: "house_cosumption_smart"
    device_class: "energy"
    state_class: "measurement"
    unit_of_measurement: "kWh"
    state_topic: "energy/dayuse"
    value_template: "{{ value | float * 1 / 1000 | round(2) }}"
    last_reset_topic: "energy/dayuse"
    last_reset_value_template: homeassistant.util.dt.utc_from_timestamp(0)

Once updated to 2022.3.8 the energy dashboard complained that there was no “last_reset”
The “last_reset_value_template” is not been converted to the “last_reset” anymore I have also confirmed this in the “States” under “developer tools” and the line is missing

So I added “last_reset” to the code above in the config but apparently it is not supported in MQTT as it errors when i check the config

So then I thought OK I will make a template and use the MQTT sensor value processed above and that should work:

  - platform: template
    sensors:
      energy_day_use:
        value_template: '{{ states(''sensor.day_energy_smart'') }}'
        unit_of_measurement: kWh
        device_class: energy
        attribute_templates:
          state_class: 'measurement'
          last_reset: '1970-01-01T00:00:00+00:00'

Well that cured the “last_reset” issue in the energy monitor and the entity “energy_day_use” has the correct values, there are no errors in the logs etc but I get nothing in the Energy integration.

Its worth mentioning I have updated the sqlite3 package to 3.34.1 2021-01-20 as part of the upgrade because the HA logs were indicating that it needed upgrading else recorder wasn’t going to work

Everything else appears to work OK just not the energy dashboard. There are no errors in the log to help point to what the issue might be.

Here is what the device looks like in device states:

And the sensor shows history:

And no issues on the Energy dashboard:

But still the energy integration is sad:

Any ideas or suggestions would be great!

Thank you

The Energy dashboard now uses state_class: total_increasing instead of last reset (in layman’s terms, actual details here: Sensor Entity | Home Assistant Developer Docs ). The legacy template sensor platform does not support this so you will either have to move your sensors to the new template integration or use customize.

Hi

Thanks for responding,

Please could you check my code and let me know if this looks correct? I’m getting the values on this template sensor in the dashboard so appears to be OK and no errors. I have excluded the last_reset and I’m not seeing any errors in the Energy dashboard yet and just waiting to see if it springs to life but wondering if there is anything I missed in the template?

template:
  - sensor:
      - name: "New Energy Today"
        unit_of_measurement: "kWh"
        state: '{{ states(''sensor.meter_read_current_use'') }}' 
        device_class: energy
        state_class: total_increasing

Thank you

Hi

I can confirm that the new message template works

Thank you for your help

1 Like