(Solved) Energy Dashboard stopped working with upgrade to 2022.2.0

Hello,
i upgraded my HA Docker installation this morning to 2022.2.0.
Since then my Energy Dashboard is empty.
Message:
Grid neutrality could not be calculated
Self-consumed solar energy couldn’t be calculated
Consumed non-fossil energy couldn’t be calculated

Developer Statistic has Errors
Entity has no state
This entity has no state at the moment, if this is an orphaned entity, you may want to remove the long term statistics of it from your database.
Do you want to permanently remove the long term statistics of sensor.e3dc_string_1_power from your database?

Did re-select the entries and saved the energy configuration.

I am quite lost i have to confess.
Any help much appreciated.

Thank you very much!

Details of my installation
#System Health

Version core-2022.2.0
Installation Type Home Assistant Container
Development false
Supervisor false
Docker true
User root
Virtual Environment false
Python Version 3.9.7
Operating System Family Linux
Operating System Version 5.4.x
CPU Architecture x86_64


3 Likes

Anyone?
Hard to believe that i am alone with this issue…

You are not. Same problem here.

Have you checked if the “state_class: total_increasing” is set on you devices ?

in the last version 2021.12 state_class: measurement was allowed, but not from 2022.02

I had the same issue, this fixed it for me

1 Like

Please show all the attributes ot your E3DC sensors, use dev tools and post a screenshot so the attributes of all of them are visibile, I want to see state_class and device_class of each of them.

I use HA container too, and upgraded to 2022.2 (now 2022.2.2) with no issues. I’m pretty confident it’s something related to how you configured your sensors + something that changed in 2022.2.

Probably you’re using state_class: measurement instead of using state_class: total or state_class: total_increasing. Remember that measurement is for power or instantaneous measurements, the Energy integration needs energy sensors. But I thought I already discussed all this with you some months ago. :slight_smile:

Read here: Sensor Entity | Home Assistant Developer Docs

Good morning Gentlemen,
first of all. Thank you for your help! Much appreaciated!

Here are the sensors which stopped working showing “0”.
I will wrap up the solution after i figured it out on how to fix it.

E3DC Battery Negative (Dischagre) Power
unit_of_measurement: W
friendly_name: E3DC Battery Negative (Dischagre) Power
last_reset: 1970-01-01T00:00:00+00:00
device_class: power
state_class: measurement

Looks as the power sensors stopped counting while the energy sensors look OK.
E3DC Solar Energy
state_class: measurement
source: sensor.e3dc_solar_power
unit_of_measurement: kWh
device_class: energy
icon: mdi:chart-histogram
friendly_name: E3DC Solar Energy
last_reset: 1970-01-01T00:00:00+00:00

1 Like

Alex, Michael → you guys rock! → Thank you for pointing this out!

The change from state_class measurement to total_increasing fixed the issue for me.

Problem description:
Energy Dashboard stopped working after upgrade to 2022.2.0
Sensors on Energy dashboard were not calculated anymore and dashboard was empty.

Resolution:

  • Change Energy sensor states from state_class measurement to total_increasing.
  • Keep Power sensor states with measurement
  • Remove last reset state
    A. Web GUI - Developer Tools - State
    B. Change in customize_global.yaml. Save and restart HA.
# General customization for power sensors
# Set class to power and enable statistic
"sensor.*_power":
   device_class: power
   state_class: measurement

"sensor.*_energy":
   device_class: energy
   state_class: total_increasing

# OLD / BACKUP - state class and last reset removed
# "sensor.*_energy":
#   last_reset: '1970-01-01T00:00:00+00:00'
#   device_class: power
#   state_class: measurement

Details:

3 Likes

I hope you now understood that measurement is used for power and total or total_increasing is used for energy.

I see a problem on your sensors: they are all named “power”, you need to distinguish between the power sensors and the energy sensors, and the names should reflect that. If you use the integral to calculate energy from power sensors, name the calculated sensors accordingly, otherwise you will make mistakes in the future and debugging problems becomes more difficult. Keep it clean and simple, the more you do it, less problems you’ll have in the future.

On energy sensors you should have:

device_class: energy
state_class: total or total_increasing (read the article I linked you in previous post)
last_reset should not be there, unless you have specific requirement, and only for `total`: `total_increasing` MUST NOT HAVE the `last_reset`, because it's supposed to be an ALWAYS INCREASING sensor.

on power sensors you should have

device_class: power 
state_class: measurement

Let me know if I’ve been clear enough…

This is how I created my power/energy sensors, Node-Red pulls data from my meter and creates the sensors in HA with the proper attributes see the difference of the attributes between the power sensor and the energy sensor below:

1 Like

Hi Alex,
ok got it. And changed it. Also changed the solution description.

device_class: energy
state_class: total_increasing
device_class: power
state_class: measurement

I use *_energy and *_power on the sensor names so i could set a global customisation.

thanks!
armin

excellent job. keep it clean and simple, ALWAYS! :slight_smile:

one last thing: read carefully in the link provided the difference between total and total_increasing, it’s very important. Everybody is following the flow using total_increasing, without paying attention to the fact that total_increasing implies that the sensor NEVER goes to 0. If it does, for whatever reason (disconnections, etc.) you can have strange results. So read the docs and analyze your specific needs.

Hi,

I changed this in the configuration file for my solar panel which comes by MQTT, but I stil have problems with the energy meter Shelly EM3. These measurements comes from the "home assistant shelly integration".
Where do I change the device_class and state_class for devices in the Shelly integration?

Use the official Shelly Integration, and you don’t have to change anything.

Alex,
I use the official Shelly integration.
Solar panels and returned energy is recorder. Energy consumption is not recorded.

This was wat my energy dashboard looks before update:


This is what it looks like after upgrade

So my solar production and the returned energy is recorded. I am using a Shelly 3EM to measure incoming and outgoing energie on the entrance of the grid.
This is the configuration. I just used the shelly integrations parameters.

And the values on the integration change. 3EM integration is working.

Show the details of the “Black/Brown/Grey Energy” sensors, from dev tools, we have to check all the attributes (device_class, state_class, etc.). With those screenshots I can’t see anything.

Also post the same for “Black/Brown/Grey Energy Returned” from dev tools, to do a comparison.

If the attributes are correct, you have another issue. Did you check Dev Tools->Statistics? Is there anything reported for those sensors?

Hi Alessandro,

thank you for your support.

The “Black/Brown/Grey Energy Returned” sensors have this config
image

The "“Black/Brown/Grey Energy” sensors seems to have a different config with the old “state_class” measurement
image

I tried to change it on this field, and click on the set button, but the change is not kept.
Is there a procedure to change the “entity states”?
I also do not understand why some sensors are updated and some are not. All sensors are in the “official Shelly integration”

thanks again for helping me.

Core 2022.2.3 Using Windows 10 logged into my Home Assistant Host through xxxx.ui.nabu.casa…(Home Assistant Cloud)
Having the exact same issue as ‘cvhoutvi’. I can delete the prior sensor (energy total) and can click on arrow to bring up drop down menu. But cannot select from that menu nor use the right slide bar to move the menu items. I tried doing a cut and past of the correct sensor name but would not allow save after the paste action. I then tried deleting my Phase 0 and Phase 1 grid sensors and starting over. Same issue. Will now try a restart of Host and see if that helps.
Update:
Rebooting Home-Assistant did not help. Then tried using my Iphone 11-ProMax through Home Assistant App. via Home Assistant Cloud as above. All editing of Energy Dashboard worked without issue.
Then went back to my Windows 10 computer (latest version and update) and had the same issue. No control of drop down menu items and unable to edit Energy.)
While I have deleted all grid and individual energy sensors (energy_total) and added them all back (energy_today). No data (or errors) have showed up in the Energy Dashboard yet. Waiting the 2 hours now.

Chris, you are customizing Shelly’s sensors, and they don’t require ANY customization.

The Black/Brown/Grey Energy sensors have a wrong state_class. Shelly Integration DOES NOT use that state_class for energy sensors. I don’t know what integration you are using, but if it’s the OFFICIAL one, it means you are also using customize: to change the attributes, and that is wrong with the official integrations. So be sure to delete all customizations or double-check you are actually using the official shelly integration.

Try to remember what you did to customize those attributes…and undo that. :slight_smile:

These are some of my shelly EMs, without any customizations, look at the attributes:

Have not been able to get Energy Dashboard working since 2022.2.0 also
Using 14 Tasmota installed power device that worked before the update with:
sensor.pzem4t_1_99_energy_total
But not allowed now…

Have tried:
sensor.pzem4t_1_99_energy_today
but not working.
No other option shows up in dropdown menu…

Have this in customize.yaml

sensor.pzem4t_1_99_energy_today:
friendly_name: Phase-0
state_class: measurement
device_class: energy
icon: mdi:home-export-outline
unit_of_measurement: kWh
last_reset: ‘1970-01-01T00:00:00+00:00’