Restore state_class to more ecowitt rain sensors#158528
Conversation
|
Hey there @pvizeli, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
This PR restores the state_class attribute for Ecowitt rain sensors that were accidentally removed in previous changes (#155321 / #155812). The fix introduces a new constant _TOTAL_INCREASING_RAIN_COUNT_SENSORS containing all rain sensors that reset periodically, enabling proper long-term statistics tracking for these sensors.
Key changes:
- Added a new constant set containing 20 rain sensor keys (totalrain, yearlyrain, monthlyrain, weeklyrain, dailyrain, and eventrain in both imperial and metric units, including piezo variants)
- Replaced hardcoded sensor key checks with a lookup in the new constant set
- All identified sensors reset at defined intervals (lifetime, yearly, monthly, weekly, daily) or conditions (event sensors reset after 24 hours without rain)
frenck
left a comment
There was a problem hiding this comment.
This PR is competing with another one; while the implementation difference is a detail of deny/allow listing, the real issue stems from it not being explicit to begin with.
See also: #158204 (comment)
../Frenck
Blogging my personal ramblings at frenck.dev
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
|
Happy to close - I only opened it due to refusal of taking into account feedback on the other PR. |
I get it ❤️ , but let's step back and make it solid 👍 ../Frenck Blogging my personal ramblings at frenck.dev |
Proposed change
Restore state-class for sensors whose state class was accidentally removed in #155321 / #155812
Alternative to #158204
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: