Energy Dashboard shows odd entry on graph after midnight

I can see that just after midnight, I get a spike but I know this must be due to how it is resetting the counter. But I’m not sure how I can dertermine which sensor I’m meant to add to sort this out.

Should I be using the sensors that are the ‘total’ or the daily one?

Please share the history graphs for the energy sensors you are using. Use the History panel, not the entity pop-up card. This ensures you will be looking at state data, not statistics (that can hide some glitches).

Hi.

Here are the picture requested.

Here are the sensors that it shows, I can’t find the one ‘Consumed Solar’.

I have the daily and Total for the Export. The energy dashboard is currently configured with the ‘Total’ sensor.


And I have the Electricity Import, again the is using the ‘Total’.

Currently my Battery Storage doesn’t have anything in the settings, but I had used

I can see that it would appear that the drop to 0, occurs a few seconds after midnight.

Should I be using the total sensor, rather than Daily?

I used to think so. I saw a lot of issues like this where the value did not reset exactly at midnight and thought it was the cause but user @karwosts told me in a post once (that I now can’t find) that the energy dashboard should be able to handle this. Maybe they have some advice.

Statistics collection (and therefore energy dashboard, which relies on statistics) is unaffected by sensors that reset to 0 when:

  • the sensor is state_class: total_increasing
    or
  • the sensor is state_class: total, and the change to zero is accompanied with an update of the last_reset attribute.

In either of those cases, the state changing to 0 will not affect the long term statistics accumulation.

Hi All,

Basically, I think I’ve fixed it.

This morning I had this showing.

Last night I swapped most of my sensors to total, but missed the export. I changed that this morning and the spike after midnight has now gone.

It helped using my PC so I could have a couple of pages open and compare the sensors I had set in the energy dashboard and the history page so I could view the sensor graphs better.

I’m not sure, if the energy help Webpage, that is linked from the energy dashboard config page, says anywhere that it’s best to use total sensors rather than the daily ones. I assume my daily ones where setting to zero just after midnight as they where being controlled by the GivTCP integration.

Regards

Thanks a lot for pointing this out.
I don’t have sensors with “total” in the labelling, but I selected the “lifetime” ones (also some form of total) instead of the daily ones for my PV system and now the midnight glitch in the matrix graphs is gone. :+1:

Hi @karwosts,

I’m encountering a similar issue where my solar production data appears glitched Solar Production. However, all my sensors are configured with state_class: total_increasing.

I have 7 different solar plants, each consisting of a different number of inverters. Each inverter drops slightly before midnight back to zero Inverter History.
But each inverter sensor is marked as state_class: total_increasing, as shown in Sensor States.

To aggregate the data per plant, I have created helpers that sum up the inverters of each plant Helper States.
These helper entities are then used in the Home Assistant Energy Dashboard.

The Issue

  • As seen in Solar production, only 4 out of the 7 plants are affected by the glitch, even though all sensors are configured with state_class: total_increasing.
  • The problem likely starts earlier, as the individual sensors already reset to zero, which should not happen with state_class: total_increasing.

Additional Notes

  • Due to the number of inverters, I use MQTT Discovery via Node-RED to integrate the sensor values.
  • Since I created the inverter sensors via scripts, I changed their state_class multiple times during the setup. Could this have caused the issue?

Any help would be greatly appreciated!

@mclordo: to check further - can you attach:

  • Energy CSV dump
  • History panel graph of one sensor from 10pm ~ 1am?
  • History panel CSV download of that same sensor/range.

I hope this is what you mean. I don’t know the correct way to publish CSV files, but it’s not that much, so I just paste it here.

entity_id,type,unit,2025-03-19T23:00:00.000Z,2025-03-20T00:00:00.000Z,2025-03-20T01:00:00.000Z,2025-03-20T02:00:00.000Z,2025-03-20T03:00:00.000Z,2025-03-20T04:00:00.000Z,2025-03-20T05:00:00.000Z,2025-03-20T06:00:00.000Z,2025-03-20T07:00:00.000Z,2025-03-20T08:00:00.000Z,2025-03-20T09:00:00.000Z,2025-03-20T10:00:00.000Z,2025-03-20T11:00:00.000Z,2025-03-20T12:00:00.000Z,2025-03-20T13:00:00.000Z,2025-03-20T14:00:00.000Z,2025-03-20T15:00:00.000Z,2025-03-20T16:00:00.000Z,2025-03-20T17:00:00.000Z,2025-03-20T18:00:00.000Z,2025-03-20T19:00:00.000Z,2025-03-20T20:00:00.000Z,2025-03-20T21:00:00.000Z,2025-03-20T22:00:00.000Z
sensor.tasmotaschaltschrank_5122_hof_in,grid_consumption,kWh,5.129999999888241,3.4499999997206032,3.0899999998509884,3.3600000001024455,3.7500000002328306,3.709999999962747,3.8900000005960464,2.720000000204891,2.6500000001396984,0.4599999999627471,0,0,0,0,0.36999999987892807,0.07000000006519258,3.2000000001862645,7.339999999850988,7.369999999878928,8.43999999994412,6.799999999580905,6.929999999934807,6.079999999841675,5.1399999998975545
sensor.tasmotaschaltschrank_5122_hof_in_cost,grid_consumption_cost,EUR,1.6929000000236556,1.1385000000009313,1.0196999999461696,1.1087999999290332,1.2375000002793968,1.2242999997688457,1.283699999912642,0.8975999999092892,0.8745000000344589,0.15179999999236315,0,0,0,0,0.12210000003688037,0.023099999991245568,1.0559999999823049,2.4221999999135733,2.4320999997435138,2.785200000042096,2.2439999998314306,2.286899999715388,2.0063999999547377,1.6962000000057742
sensor.schuppen_energy,grid_return,kWh,0,0,0,0,0,0,0.1000000000003638,0.4399999999995998,2.9000000000005457,4.949999999999818,12.710000000000036,18.539999999999964,17.979999999999563,17.420000000000073,13.11999999999989,13.579999999999927,4.720000000000255,2.449999999999818,0,0,0,0,0,74.89000000000033
sensor.saisonhaus_energy,grid_return,kWh,0,0,0,0,0,0,0,0.19999999999998863,0.30000000000001137,0.8000000000000114,2.5,2.7999999999999545,2.6000000000000227,2.1000000000000227,1.1999999999999318,0.8000000000000682,0.2999999999999545,0.10000000000002274,0,0,0,0,0,0
sensor.tasmotaschaltschrank_3418_prod_stall,grid_return,kWh,0,0,0,0,0,0,0,0,1,2,6,7,8,8,6,7,2,1,0,0,0,0,0,0
sensor.tasmotaschaltschrank_5122_out_kuhlneu_kisten,grid_return,kWh,0,0,0,0,0,0,0,0.04000000000814907,0.25,3.070000000006985,10.549999999959255,13.880000000004657,14.879999999975553,12.469999999942956,6.600000000005821,6.19999999992433,0.7200000000011642,0,0,0,0,0,0,0
sensor.wohnhaus_energy,grid_return,kWh,0,0,0,0,0,0,0,1,1,3,8,10,8,7,3,3,0,1,0,0,0,0,0,0
sensor.tasmotaschaltschrank_3152_prod_kuhlalt,grid_return,kWh,0,0,0,0,0,0,0,0,2,3,8,10,9,8,4,3,1,0,0,0,0,0,0,0
sensor.schuppen_energy_compensation,grid_return_compensation,EUR,0,0,0,0,0,0,0.051229268292672714,0.225408780487669,1.4856487804875087,2.5358487804879815,6.511240000000157,9.497906341463363,9.211022439024418,8.924138536585247,6.721279999999979,6.956934634146478,2.4180214634147887,1.2551170731709362,0,0,0,0,0,38.36559902439012
sensor.saisonhaus_energy_compensation,grid_return_compensation,EUR,0,0,0,0,0,0,0,0.0574799999999982,0.0862199999999973,0.2299199999999928,0.7185000000000024,0.8047200000000068,0.7472399999999944,0.6035399999999846,0.3448799999999892,0.2299199999999928,0.0862199999999973,0.0287399999999991,0,0,0,0,0,0
sensor.tasmotaschaltschrank_3418_prod_stall_compensation,grid_return_compensation,EUR,0,0,0,0,0,0,0,0,0.5452999999979511,1.0905999999959022,3.2717999999877065,3.8170999999856576,4.362399999983609,4.362399999983609,3.2717999999877065,3.8170999999856576,1.0905999999959022,0.5452999999979511,0,0,0,0,0,0
sensor.tasmotaschaltschrank_5122_out_kuhlneu_kisten_compensation,grid_return_compensation,EUR,0,0,0,0,0,0,0,0.01123135384636953,0.07019596153850216,0.8620064076922063,2.9622695769219263,3.897279784616387,4.178063630769429,3.5013745615394782,1.8531733846153884,1.740859846153569,0.20216436923118408,0,0,0,0,0,0,0
sensor.wohnhaus_energy_compensation,grid_return_compensation,EUR,0,0,0,0,0,0,0,0.287399999999991,0.287399999999991,0.862199999999973,2.299199999999928,2.87399999999991,2.299199999999928,2.011799999999937,0.862199999999973,0.862199999999973,0,0.287399999999991,0,0,0,0,0,0
sensor.tasmotaschaltschrank_3152_prod_kuhlalt_compensation,grid_return_compensation,EUR,0,0,0,0,0,0,0,0,1.0306000001728535,1.5459000002592802,4.122400000691414,5.153000000864267,4.637700000777841,4.122400000691414,2.061200000345707,1.5459000002592802,0.5153000000864267,0,0,0,0,0,0,0
sensor.schuppen_energy,solar_production,kWh,0,0,0,0,0,0,0.1000000000003638,0.4399999999995998,2.9000000000005457,4.949999999999818,12.710000000000036,18.539999999999964,17.979999999999563,17.420000000000073,13.11999999999989,13.579999999999927,4.720000000000255,2.449999999999818,0,0,0,0,0,74.89000000000033
sensor.kistenlager_energy,solar_production,kWh,0,0,0,0,0,0,0.0999999999994543,0.8000000000001819,1.6000000000003638,3.5999999999994543,7.5,11.199999999999818,12.800000000000182,13.100000000000364,9.699999999999818,11.699999999999818,5.900000000000546,1.0999999999994543,0.1999999999998181,0,0,0,0,81.20000000000073
sensor.kuhlraum_neu_energy,solar_production,kWh,0,0,0,0,0,0,0,1,1,2,7,9,7,5,3,2,0,0,0,0,0,0,0,0
sensor.kuhlraum_alt_energy,solar_production,kWh,0,0,0,0,0,0,0.009999999999990905,0.7300000000000182,1.2800000000002,2.8999999999998636,8.870000000000118,10.039999999999964,9.149999999999864,7.5,4.420000000000073,3.1800000000000637,0.7799999999999727,0.41000000000008185,0.1999999999998181,0,0,0,0,98.47000000000003
sensor.stall_energy,solar_production,kWh,0,0,0,0,0,0,0,0.5,0.8999999999998636,2.1000000000001364,5.399999999999864,7.400000000000091,8.099999999999909,7.900000000000091,5.599999999999909,6.7000000000000455,2.400000000000091,0.7000000000000455,0,0,0,0,0,69.5
sensor.wohnhaus_energy,solar_production,kWh,0,0,0,0,0,0,0,1,1,3,8,10,8,7,3,3,0,1,0,0,0,0,0,0
sensor.saisonhaus_energy,solar_production,kWh,0,0,0,0,0,0,0,0.19999999999998863,0.30000000000001137,0.8000000000000114,2.5,2.7999999999999545,2.6000000000000227,2.1000000000000227,1.1999999999999318,0.8000000000000682,0.2999999999999545,0.10000000000002274,0,0,0,0,0,0

This is in the CSV file from one sensor:

entity_id,state,last_changed
sensor.wr30_008_1_2000066262_ertrag,11700,2025-03-21T21:00:37.377Z
sensor.wr30_008_1_2000066262_ertrag,0,2025-03-21T22:55:02.955Z 

And here the history plot for the above csv file.

So all I get from that is that the data from the sensors is pretty clean. But I expacted them to be clean because I scrap them from the Webpage of a local Controller with node red. And due to the issue, I thought I can resolve it with a clean cut from the sensors over midnight, so I block the sensor readings between 23:55-00:05.

So this entity id sensor.wr30_008_1_2000066262_ertrag does not appear to be used in your energy dashboard.

Can you check you have the correct entities?

(The way you shared the csv data was fine, thanks :+1: )

You can drag and drop the file into your post. Like this

history.csv (124.4 KB)

As mentioned earlier in my first post, I use a helper to sum multiple inverters together into a “plant.” For example, “Kistenlager” in the energy dashboard consists of:

sensor.wr7ktl15_2_2000417102_ertrag
sensor.wr8ktl15_2_2001308965_ertrag
sensor.wr6ktl15_2_2001540645_ertrag

When I checked the Kistenlager helper CSV, I found this, which is causing the issue:

sensor.kistenlager_energy,69.7000,2025-03-21T16:59:08.243Z
sensor.kistenlager_energy,47.2000,2025-03-21T22:55:02.973Z
sensor.kistenlager_energy,24.5000,2025-03-21T22:55:02.976Z
sensor.kistenlager_energy,0.0000,2025-03-21T22:55:02.982Z

The reason for this is that the individual inverter sensors are not perfectly synchronized when they reset to zero. This happens because I use a for loop in Node-RED.

sensor.wr7ktl15_2_2000417102_ertrag,0,2025-03-21T22:55:02.976Z
sensor.wr8ktl15_2_2001308965_ertrag,0,2025-03-21T22:55:02.980Z
sensor.wr6ktl15_2_2001540645_ertrag,0,2025-03-21T22:55:02.973Z

Is there a sensor option to ignore lower values (except for zero) when using state_class = total_increasing? Or is there another way to work around this issue?

It’s difficult to synchronize the updates perfectly and I’m not sure if that would make a difference because the helper probably gets updated after each individual entity change.

I also don’t want to use the inverters as separate sensors in the energy dashboard because that would mess up the layout.

Appreciate the help, @karwosts

Tried that the first time, but the forum didn’t let me…

Probably should be more active to earn the CSVs

If you know exactly when those sensors will reset, you put logic in your template sensor to force it to 0 before the first one resets, until after the last one has reset.

But yes you’ve correctly identified that there are synchronization issues to what you are doing.

Generally I don’t recommend mixing any energy sensors via templates, as it has problems like this.

What “Layout” is messed up by adding them individually?

1 Like

By layout, I really mean the listing of the individual sensors at the bottom. But i think that’s the best way to go. Thanks for your help