Reverse Energy dashboard - data unusable

Today I looked at my energy stats, it seemed like I had suddenly hardly used any energy this year.
Then I saw that something went wrong on February 15 and the energy was counted away instead of being added.
My annual energy is no longer usable. Can this still be corrected somehow?

Normal:

Error:


Can I maybe remove the whole day from the recorder? if so, how?

It is probably one value that is wrong. In developer tools statistics you can find the sensor and edit the bad value(s). Do first try to find the right date /time though, the UI only shows small time windows at a time.

1 Like

Thank you! I found them, everything happend on 15-2 at 15:00… i have no idea how or what and where its comes to it’s weird values.
But will find every device now and edit it back to the value closes to the hour before.


Thanks! was afraid I had to restart with a new database.

Somehow the totals decreased (most likely all a 0 value) or stepped back to a previous point in time. How? anyones guess.

Then the sensors, according to the state class decide how to handle it. As you get negatives, the state class is likely total (not total_increasing). They will register the drop as energy production instead of use. Had the state class been total_increasing, it would have assumed the meter was reset and you would probably have seen a huge positive spike when the real meter values would come in again.

If the sensors used in the energy dashboard are template sensors, make sure they have an availability template to make them unavailable when needed. Do’t let them return 0 when the input value is unavailable. If an integration returns 0 when they should have reported unavailable, then put in an issue for the integration builder.

1 Like

The sensors are created by the integration, the most are total_increase

Devices also:

Seems i made a small fortune that day, all the cost sensors are also effected so i should correct them also.

My own energy sensors are Template, but not used in the Energy Dashboard:

  # Daily Energy
      - name: "Daily Energy"
        unique_id: "daily_energy"
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: total_increasing
        state: "{{ ( states('sensor.daily_energy_offpeak')|float + states('sensor.daily_energy_peak')|float ) | round(1) }}"
        availability: "{{ has_value('sensor.daily_energy_offpeak') and has_value('sensor.daily_energy_peak') }}"

I used total_increase for the sensors in present time, and total for the data in the past (last_period).

  # Yesterday Energy
      - name: "Yesterday Energy"
        unique_id: "yesterday_energy"
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: total
        state: "{{ ( state_attr('sensor.daily_energy_offpeak','last_period')|float + state_attr('sensor.daily_energy_peak','last_period')|float ) | round(1) }}"
        availability: "{{ state_attr('sensor.daily_energy_offpeak','last_period')|is_number and state_attr('sensor.daily_energy_peak','last_period')|is_number }}"

Is this the correct way?

Thanks :smiley:

It seems you did everything right, but for total_increasing this is weird. I do not see how you’d get at negative values other than an overflow.

Only thing I can think of is that I dit a backup restor or a database purg… but i do not remember if it was that day and time exactly…

Seems i corrected al values now, cost and usage looks normal again.

Thanks a lot :slight_smile:

1 Like