I don’t get it, this used to work, now the units are all over the place. Do they expect daily counters? Solar production is correct except for one device, the 38.7 kWh are OK, too, but that’s an all time counter, not a daily resetting one. Same for the energy usage. do I need to change this for resetting meters?
It can work with either resetting or ever increasing sensors. The entity’s state_class has to be correct for this though (total_increasing or total respectively).
Looks like there was an issue with your grid energy sensor.
Go to the history panel and find the entity you specified for the grid energy. What does the history graph look like at the point where that massive increase (>14MWh) was at the end of the day?
Do not use the more info pop-up graph for this, it uses statistics, not state data. We want to see the raw reported state data.
Also which integration creates this grid sensor?
If it is a template sensor it may need an availability template. See: Why an availability template is important for energy template sensors
The good news is that you can easily correct this glitch in Developer tools → Statistics. But before I tell you how to do that we need to work out why it happened. So we can prevent it from happening again.
Hi!
it’s directly from a shell3 pro em
- name: "Power Meter Total Energy"
unique_id: "shelly_meter_total_energy"
state_topic: "shellies/shellypro3em-a0dd6ca10288/status/emdata:0"
value_template: "{{ value_json.total_act }}"
unit_of_measurement: "Wh"
device_class: "energy"
state_class: "total_increasing"
availability_topic: "shellies/shellypro3em-a0dd6ca10288/online"
payload_available: "true"
payload_not_available: "false"
there’s no availabilty template, though.
I couldn’t see 14 MWh anywhere in the history, it’s at ˜7 MWh (in Wh) and increasing.
Regards
Patrick
Please share the history graph covering the same time period as the energy graph shown above.
Any reason you are using MQTT rather than the Shelly integration?
That would be that one I guess?
Yes I do have a reason why I use MQTT. Not 100% sure right now, I think it’s because I needed the data at a high rate also in Iobroker and there’s no iobroker to hass bridge (only the other way around)
Can you shoe what happens to the graph over the midnight boundary?
Zoom in to the range 22:00 to 02:00. I suspect it dipped in value a bit which would register as a reset for a total_increasing sensor.
If so, to prevent it happening again all you need to change is this:
state_class: "total_increasing"
to this:
state_class: "total"
And you should be able to edit out the glitch in Developer Tools → Statistics. Find your entity and:
The Outliers button isn’t perfect but it should be able to find that huge jump.
Set the value to the average of the readings either side of that time by navigating to the value using the date and time picker in the card.
It didn’t find an outlier that day, but I’ll keep looking. Today the data looks normal (not sure if it’s because I changed to total instead of total increasing?)
but what bothers me more is the other entry that’s wrong:
- name: "Powerstream Guesthouse Energy"
unique_id: "shelly_powerstream_guesthouse_energy"
state_topic: "shellies/shellyplug-s-C8C9A3B8F93A/relay/0/energy"
availability_topic: "shellies/shellyplug-s-C8C9A3B8F93A/online"
payload_available: "true"
payload_not_available: "false"
device_class: energy
state_class: total
unit_of_measurement: "Wh"
this is how it is defined
But it shows up with kWh:
How can I correct that?
Click on the ⓘ icon beside the entity (or the entity itself in a dashboard), click the cog icon and set the unit you want.
Oh boy I messed up that one. I thought if it’s defined as Wh in the MQTT definition changing it somewhere in the UI would just show it recalculated in the other unit, not actually change the definition.



