Entities keep history for only 7 days

Hi, for some reason all my entities keep history for only 7 days. It applies to sensors with or without state class defined. As far as I know, when I dont define anything for the sensor (or entity) it should keep statistics for 10 days. I dont have recorder database configured. I started happening few udpates back, dont remember exaclty when, this year, but I couldnt find any mention of any changes regarding this.

statistics are kept forever, history is kept for 10 days. The lack of a state class means you will not get statistics for that entity, but you'll still get history. How are you determining that you only have 7 days of history?

From the history tab.

state:
  translated: 23,4 °C
  raw: "23.43"
  last_changed: "2026-06-08T10:56:05.140Z"
  last_updated: "2026-06-08T10:56:05.140Z"
attributes:
  state_class: measurement
  entity_id:
    - sensor.bathroom_temperature
    - sensor.bedroom_temperature
    - sensor.living_room_temperature
    - sensor.hall_temperature
    - sensor.kitchen_temperature
    - sensor.study_room_temperature
  unit_of_measurement: °C
  device_class: temperature
  icon: mdi:home-thermometer-outline
  friendly_name: Indoor Temperature
state:
  translated: "Off"
  raw: "off"
  last_changed: "2026-06-07T22:24:13.155Z"
  last_updated: "2026-06-07T22:24:13.155Z"
attributes:
  min_color_temp_kelvin: 2202
  max_color_temp_kelvin: 6535
  effect_list:
    - blink
    - breathe
    - okay
    - channel_change
    - finish_effect
    - stop_effect
  supported_color_modes:
    - color_temp
  effect: null
  color_mode: null
  brightness: null
  color_temp_kelvin: null
  hs_color: null
  rgb_color: null
  xy_color: null
  icon: m3of:door-front
  friendly_name: Hall
  supported_features: 44

state:
  translated: 129,04 kWh
  raw: "129.04"
  last_changed: "2026-06-08T08:38:44.440Z"
  last_updated: "2026-06-08T08:38:44.440Z"
attributes:
  state_class: total_increasing
  unit_of_measurement: kWh
  device_class: energy
  friendly_name: power_plug Energy

Wait another day to see if you get more history. There's no reason your system should purge/delete after 7 days if you didn't configure recorder to do so.

I have been monitoring it for a while now, but sure, I can post same history tomorrow.

I mean, the other option is for you to share your entire configuration. Recorder hasn't changed in a long time. There's nothing that would cause it to only store 7 days when the default is 10.

Default remains 10, shown here:

2026-06-08 10:06:39.516 WARNING (Recorder) [homeassistant.components.recorder.db_schema] State attributes for sensor.unavailable_devices exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
2026-06-08 10:06:39.516 WARNING (Recorder) [homeassistant.components.recorder.db_schema] State attributes for sensor.unavailable_devices exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored

Have this warn in logs, so I have deleted that sensor and I guess I will check tomorrow. No other suspicious logs.

Can I enable debug logs from the Recorder to see when and if it deletes the data?

I can share the config, it the configuration.yaml enought?

That's just telling you it won't save the attributes. Your state for that sensor will still be saved.

Sure

Yes, unless you use packages. If you use packages, you have to show all the package yaml that you use.

Also the energy dashboard history goes back only 7 days. I was under the impression that is has its own history, because when things were working for me it went months back even though the sensor did not

energy dashboard pulls from statistics.

But it should go further that 7 or even 10 days right?

It depends on a lot of things. It should go past 7 days, yes. However, we have no idea what you may or may not have done with your current configuration. We are going off what you've said, which basically amounts to "I'm not getting more than 7 days of data".

Also check there isn't a FIX ISSUE button next to your entity in Developer Tools -> Statistics.

All entities are without an issue.

Then I suggest you share your full configuration and your full logs from the past ~10 days.

Config and log here GitHub - bladecell/homeassistant · GitHub

History got deleted again, but logs from yesterday got overwritten...

Are you sure it’s not your DB-file which periodically gets corrupted ?

Not sure about the “logs got overwritten” issue, Have you tried to actually “Scroll” eternally in the RAW-Log View ?

History got deleted + Logs ( cleared somehow ), does indicate …. something’s seriously “unstable” in your system

My docker log is limited to 50MB, one file. The home assistnat logs in /config starts today at 8, when I restarted the container unaware of the history detetion.

I guess the DB file could get corrupted but dont know hot to verify this or test this.