-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
Statistic card - when period is rolling window it only access the last 11-12 days of data #115212
Comments
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) recorder documentation |
Looking at this a bit I think the bug might be here: core/homeassistant/components/recorder/statistics.py Lines 1302 to 1311 in d4500cf
When we look for a change over a long period, we crack the time window into the head (fraction of hour at the start), the main (complete hours over the period), and the tail (fraction of hour at the end). We look for the oldest statistic to compute the start of the diff for the change, but for the head period we look in the short term statistics table for the oldest entry. The function Out of time at the moment to look further but that's what it seems like so far. |
The problem
I initially created this issue in frontend, but was told this is likely a backend issue, so I'm copying it here.
When setting up a statistics card to show data based on long statistics sensor, and using rolling window as period, it only seems to include data from the last 11-12 days. That is, setting the rolling window to anything over 12 days does not change the displayed result, even though there is older data for the sensor.
Here's my specific configuration:
At the moment, this produces a result of 272.84 kWh, same as if I change days to 12. However, from the energy dashboard that uses the same sensor, I can see the actual value from the last 365 days should be around 7500 kWh.
What version of Home Assistant Core has the issue?
core-2024.4.1
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
No response
Link to integration documentation on our website
https://www.home-assistant.io/integrations/recorder/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
A comment from the issue in frontend suggesting this is backend problem:
Originally posted by @karwosts in home-assistant/frontend#20469 (comment)
The text was updated successfully, but these errors were encountered: