the problem is, for my understand, that the sonsor jumps from 2080 kwh to zero…
i think the origin is, that the rieman is a new sensor switch has starts at 0, but it has to starts at 2079 because of the last value of the migrated sensor…
it think a “simple” delete would not help, because this would only shift the drop from 2080 kwh to 0 from yester to today…
I think the solution is to adapt the new values to the old ones… but unfortunately I’m not sure what else needs to be taken into account apart from the statistcs table
You are mistaking there. Depending on the state_class, HA determines how to handle a drop to 0: as a sensor reset or as energy production. It stores what it thinks it should do in statistics, which is now likely only one errant assumption. Statistics record changes since the last value, so one sensor reset, one possibly bad statistics value. That is the behavior within one sensor that resets to 0.
Also remember you can keep old entities in the energy and add new ones. The dashboard will add the old and the new sensor. The old will not change any more, but that does not matter. So the energy dashboard does not require you to create helpers for everything.
What you do have to do, is to make sure the sensors you use do not go to 0 when they should read unavailable. That will mess op the dashboard each time it happens. That too is one errant value in statistics you can just delete, but you would not want to do that all the time.
Find out which time it happens, go to developer tools, statisctics page. Find the statistics entity, click the icon on the right. Find the right time, and edit the weird value.
If you edit the last value in the statistics table, then I guess yes, it might happen again. The statistics values as you can see are deltas (differences since last), so if you edit in the past you only edit that it.
You don’t edit the sensor state itself. If a Riemann sum starts at 0 there’s not much you can do about it apart from creating another sensor that adds a value to it. I would keep it as is.
What you edit is statistics. If the value for now is bad, wait a few hours, then edit it - I think the last statistics value might be used to calculate the new value.
That is why you should keep the old sensor in the energy dashboard and add new ones if you change how the energy is measured.
If you keep using the same entity, but the entity resets, that is also ok for the energy dashboard if the sensor state_class is total_increasing. It will then assume your meter was reset.
Statistics do not care about the actual value that much, only to calculate the difference since the last measurement. Statistics are just increases and decreases. If there’s a bad increase or decrease in it it can simply be removed and the graph will be ok again.
Changing the state in developer toos is a debug feature, it is not meant to actually change what is recorded. It will mess up your statistics though, because the calculation between the current and the previous value is based on something that you entered and not on the real state. If that is what you were doing all the time, I can understand that the statistics went ballistic.
The integration decides a value for an entity. It depends on the integration what that value is or how it is determined. HA stores it in a state machine (memory) and records it in the recorder for short to medium term storage. Statistics are made for some entities for long term storage. HA assumes they all match, but if you edit the state through developer tools, the value in memory does not match with the rest and the integration is not aware it happened.
Then when the integration determines a new value (unable to tell where it comes from, might use the state in memory, might use the recorder or the statistics too, but more often than not just from outside sources) it saves it in the recorder again and the statistics try to see what changed since last. If the diffently stored values are not matching up with one another, anything might happen.
What I said is: the integration decides the new value. It can use whatever it likes. Memory, recorder, outside stuff. Same for statistics. It may use memory, it may use the recorder. So yeah, the 38 you entered may affect all kinds of things. Rebooting might also decide to store memory values in the recorder. You editing anything other than statistics will mess things up in ways you cannot imagine upfront. HA is not designed to take this kind of modification into play.
The advice you got was you can edit statistics. The rest you did was confusing HA, you and me. For me it clear that your efforts will yield unpredictable results, I tried to explain that.