You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (history) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of history 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 history 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.
I copied the history component over as a custom component and added logger to it.
_LOGGER.info(f"history returning empty for entity_ids: {entity_ids} {get_instance(hass).recorder_runs_manager.first.start}")
which produces following log line:
2024-05-20 18:26:54.129 INFO (MainThread) [custom_components.history] history returning empty for entity_ids: ['sensor.load_power'] 2024-05-19 15:56:03.193007
The problem
I use emhass to automate energy usage. Emhass queries past power usage using /api/history/period/ endpoint. About once a month it fails to retrieve data from a specific time range. After a day or so the issue mitigates automatically. I have narrowed it down to something to do with end_time. By default it's start + 1 day.
I am getting a 200 OK response, but body is "[]" when it does not work.
https://HA:8123/api/history/period/2024-05-18T15:56:00+00:00?filter_entity_id=sensor.load_power does not work
https://HA:8123/api/history/period/2024-05-18T15:56:00+00:00?filter_entity_id=sensor.load_power&end_time=2024-05-19T18:56:00 also does not work
Extending it by 1 minute to https://HA:8123/api/history/period/2024-05-18T15:56:00+00:00?filter_entity_id=sensor.load_power&end_time=2024-05-19T18:57:00 returns data just fine.
I suspect the code path it takes is https://github.com/home-assistant/core/blob/7998f874c09afc0d0537279d92aefb92da6fc573/homeassistant/components/history/__init__.py#L110C31-L110C53
Is there a way to check recorder_runs_manager.first.start manually?
How can I troubleshoot this further?
What version of Home Assistant Core has the issue?
2024.5.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
history
Link to integration documentation on our website
https://www.home-assistant.io/integrations/history/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: