home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.64k stars 29.94k forks source link

The Data Recorder saves incorrect values when Home Assistant restarts. #119458

Open marc965 opened 3 months ago

marc965 commented 3 months ago

The problem

I don't know the exact cause of this problem. As soon as I restart Home Assistant, all the values in the statistics are incorrect for the next hour. This is particularly noticeable on the Energy Dashboard. The recorder and the 'Utility Meters' seem to reset to 0 instead of using the last saved value. This began with Homeassistant version 2024.x

Without a restart, everything runs perfectly. The problem is triggered with every restart. I have already tried to reduce the load by decreasing the number of recorded entities, but unfortunately, this hasn't helped.

I have also tried to improve database performance by switching to an external database. The migration to MariaDB 10 was very successful, but it did not solve the problem.

Tried to reduce purge_keep_days. Setting: commit_interval: 30 Activating: auto_purge: true Acvtivating: auto_repack: true But nothing helps :-(

I started integrating my Victron Cerbo-GX device last year. Could this be caused by an increasingly high MQTT load? image

This affects all 'Utility Meters' – not just those on the 'Energy Dashboard'.

Please let me know what I can do or what additional information is needed to get to the bottom of this annoying problem.

What version of Home Assistant Core has the issue?

core-2024.5.5

What was the last working version of Home Assistant Core?

dont know exactly but the last 2023 Version was ok

What type of installation are you running?

Home Assistant OS

Integration causing the issue

? Recorder, Utility Meter ?

Link to integration documentation on our website

https://www.home-assistant.io/integrations/recorder/ https://www.home-assistant.io/integrations/utility_meter/

Diagnostics information

No response

Example YAML snippet

db_url: mysql://homeassistant:_*******@192.168.133.40:3306/homeassistant_db?charset=utf8mb4
purge_keep_days: 1
commit_interval: 30
auto_purge: true
auto_repack: true
include:
  domains:
    - switch
    - binary_sensor
    - climate
  entities:
     ***

Anything in the logs that might be useful for us?

No response

Additional information

Here you can see that I restarted Home Assistant three times: image

A dy before - all statistics are ok: image

System Load is ok in my opinion: image

home-assistant[bot] commented 3 months ago

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (recorder) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `recorder` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign recorder` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


recorder documentation recorder source (message by IssueLinks)

garry0garry commented 2 months ago

The temporary solution is auto_purge: false. Do I understand correctly that the cause of the problem has not been found?

marc965 commented 2 months ago

Hi.

Yes, you are right. Unfortunately, no one has responded regarding this issue. The error is still present. I don't even dare to install version 2024.7.3. My current version is 2024.6.4. Since no one has responded, I assume the error still exists.

Last weekend, I needed a restart of HA due to a configuration change, and I encountered it again.

Since no one has responded so far, I assume that I am the only one with this error. I can't think of anything else to try.

I can't understand the suggestion to set auto_purge to false for now. My database is already quite large, and I fear it could make things worse.

marc965 commented 2 weeks ago

Installed latest Version now: Core2024.8.3, Supervisor2024.08.0, OS13.1... Error still present.

This is very annoying, as the statistics for an entire day are regularly completely ruined. It's a shame that there's no one there to analyze the problem. I am happy to offer my support.

Is probably linked with MQTT sensors or something else...