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

Support for counting average of long-term statistics sensor #223

Open
3 tasks done
kheikola opened this issue Feb 14, 2024 · 1 comment
Open
3 tasks done

Support for counting average of long-term statistics sensor #223

kheikola opened this issue Feb 14, 2024 · 1 comment

Comments

@kheikola
Copy link

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

I'm trying to calculate monthly average of electricity spot price, which changes every hour. With following arguments it should work nicely:
start: "{{ now().replace(day=1).replace(hour=0).replace(minute=0).replace(second=0) }}"
end: "{{ now() }}"
However, my recorder purge_keep_days is the default 10 days, and increasing that to 31 days would explode the database size. So it means the sensor which I'm calculating monthly average, only contains last 10 days worth of data.
As my goal is to calculate average for full month, result starts to fail after day 11.

Describe the solution you'd like

As the sensor from which I'm counting the average has state_class: measurement, it has the long-term statistics. So I can see the sensor history for the full month. However it seems that average does not count for long-term history measurements.
So can it be enhanced to calculate average also using long-term statistics data?

Describe alternatives you've considered

Alternative obviously is extending recorder purge_keep_days to 31, but despite recorder exclusions and purge automation for largest sensors, it would still increase my recorder db size dramatically.

Additional context

image

@vistalba
Copy link

Have a simliar need. Want to calculate an averagy YtD (Year-to-date). So... will shortly run out of recorder data when not using histroy statistics.

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

No branches or pull requests

2 participants