Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

History data lost after 10 days #274

Open
msutryk opened this issue Oct 17, 2024 · 3 comments
Open

History data lost after 10 days #274

msutryk opened this issue Oct 17, 2024 · 3 comments
Labels
question Further information is requested

Comments

@msutryk
Copy link

msutryk commented Oct 17, 2024

Hi all,

I have a problem with the data from the integration not being stored long-term. It seems like it's being removed after 10 days. It's like this for all entities.

I've been using this integration for months now.

All other HA integrations seem to store the data from the day they were installed.

Home Assistant
Core
2024.10.2
Supervisor
2024.10.2
Operating System
13.1

foxess-ha version:
v0.4

@msutryk msutryk added the bug Something isn't working label Oct 17, 2024
@FozzieUK
Copy link
Collaborator

It's not the integration at fault here - by default Home Assistant doesn't store sensor data any longer than 10 days, you can increase it if you want by adding this to your configuration.yaml at the top.

recorder:
  purge_keep_days: 182

That would keep sensor data for 182 days (6 months) but your database would obviously get bigger as a result.

If you add the load (sensor.foxess_load) and grid consumption (sensor.foxess_grid_consumption) and battery charge / discharge totals (sensor.foxess_bat_charge and sensor.foxess_bat_discharge) to your energy dashboard it will retain those statistics in your energy dashboard indefinitely.

@FozzieUK FozzieUK added question Further information is requested and removed bug Something isn't working labels Oct 17, 2024
@msutryk
Copy link
Author

msutryk commented Oct 17, 2024

Hi @FozzieUK, thank you for taking the time to answer my problem. OK, it might be the case, what made me doubt it is that the other entities, like my Midea AC, Panasonic Heatpump, or simple zigbee temp sensors, are keeping the data for months but when I check my Battery SoC it's only 10 days.

You are right - when I look at the data in my energy dashboard I can look back for months.

I'll look into recorder.

Thank you!

@FozzieUK
Copy link
Collaborator

No problem, it is possible for sensors to be loaded as long term statistics, but with this integration as it creates so many sensors it can get a bit heavy on storage.

When you increase the recorder setting, do it carefully and keep an eye on your database size as it can become unmanageable if you have other applications that have rapidly changing sensors - this integration doesn't the sensors only update every 5 minutes at best.

If there are certain sensors that you really want to keep 'long term' you can create a template sensor using them as the source and then set it with a state_class ('measurement', 'total' or 'total_increasing') this tells HA to record them as statistics . That way you don't increase the overall size of your database and get to keep data much longer for the sensors you really want to watch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants