My energy dashboard in Home Assistant was empty after I upgraded its Docker container to the 2025.4.1. In the log files, which can be accessed via Settings -> System -> Log, I found a lot of problems. One specific:
Logger: homeassistant.helpers.recorder Source: helpers/recorder.py:96 First occurred: 2:21:37 PM (1 occurrences) Last logged: 2:21:37 PM Error executing query Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/recorder.py", line 96, in session_scope yield session File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 580, in compile_missing_statistics modified_statistic_ids = _compile_statistics( instance, session, start, end >= last_period ) File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 664, in _compile_statistics compiled: PlatformCompiledStatistics = platform_compile_statistics( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ instance.hass, session, start, end ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/src/homeassistant/homeassistant/components/sensor/recorder.py", line 537, in compile_statistics last_stats = statistics.get_latest_short_term_statistics_with_session( hass, session, to_query, {"last_reset", "state", "sum"}, metadata=old_metadatas ) File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 2164, in get_latest_short_term_statistics_with_session return _sorted_statistics_to_dict( hass, ...<6 lines>... types, ) File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 2443, in _sorted_statistics_to_dict _stats = _build_stats(*build_args, row_mapping) File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 2338, in _build_stats "end": start_ts + table_duration_seconds, ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
I opened the terminal and went to the config directory of my Homea Asistant and opened the home-assistant_v02.db via sqlite3.
sqlite3 home-assistant_v2.db
Within sqlite3 I run
DELETE FROM statistics_short_term WHERE start_ts IS NULL;
I restarted Homeassistant and - voila the energy dashboard was back!
- Log in to post comments