Add Comprehensive Weather Observation Sensors#48
Add Comprehensive Weather Observation Sensors#48hmmbob wants to merge 2 commits intoPaulVanSchayck:mainfrom
Conversation
|
Not sure what to do to get ruff to pass - error isn't very clear |
|
Is it possible to add tomorrow temperature sensors? Both 'regular' (max) and 'low'. |
|
Quite probably yes, but that's in another dataset so I'll have a look at that separately |
That was very easy. Added to this PR in e2a0cad
|
|
I appreciate the effort @hmmbob! I have been making progress with a solution to issue #38. I want to get that done before adding the sensors, as that already makes breaking changes to the service/entity structure. Adding more sensors before that only makes the breaking changes larger. Hopefully I'll have a draft pr open soon. |
Cool. But, what would the issue be then? About selecting the station? Checking, 'cause the spinner showing in the observation weather entity more info section was a HA bug and was fixed on their side. And I'll rebase after the changes, no worries. |
|
See #38 (comment) for my current thoughts on how to handle the station selection. It's indeed along the same lines you're thinking. |
|
Thank you both for your work regarding this integration! I look forward to the new version(s) |
|
I'm thinking we could actually already implement the forecast sensors right now. @hmmbob would you be willing to cherry-pick those sensors and create a new PR out of it? |
|
I'm happy to take a look at a rebased version of this PR. It needs a bit of work after the changes made for version 0.7.0. |
7b9549b to
cf8ebac
Compare
|
I think it's ready to go! Sorry, haven't had time to test 0.7.0 before today, wasn't at home.... :-) |
PaulVanSchayck
left a comment
There was a problem hiding this comment.
Thanks. I've added some comments. Some are maybe a bit pedantic. I hope you don't mind.
While reviewing, I noticed I broke the weather condition code. See PR #80
| "name": "Windsnelheid" | ||
| }, | ||
| "observations_wind_gust": { | ||
| "name": "Windvlaag" |
| value_fn=_get_cloud_coverage, | ||
| ), | ||
| ObservationSensorDescription( | ||
| key="wind_direction", |
There was a problem hiding this comment.
Can we call this and all related functions and keys wind_direction_cardinal?
| value_fn=lambda data: _get_observation_param(data, "td"), | ||
| ), | ||
| ObservationSensorDescription( | ||
| key="wind_azimuth", |
There was a problem hiding this comment.
Can we call this wind_direction? I don't think azimuth is incorrect, but only a bit unusual to use in the context of wind direction.
| temp_key: str | None = None | ||
|
|
||
|
|
||
| CARDINAL_DIRECTIONS = [ |
There was a problem hiding this comment.
Would it be safe to import this from VALID_CARDINAL_DIRECTIONS from components.weather.significant_change?
| translation_key="observations_cloud_coverage", | ||
| state_class=SensorStateClass.MEASUREMENT, | ||
| native_unit_of_measurement=PERCENTAGE, | ||
| suggested_display_precision=1, |
There was a problem hiding this comment.
| suggested_display_precision=1, | |
| suggested_display_precision=0, |
We only got 8 different values.
| value_fn=lambda data: _get_observation_param(data, "dd"), | ||
| ), | ||
| ObservationSensorDescription( | ||
| key="cloud_coverage", |
There was a problem hiding this comment.
Add an icon? Maybe mdi:cloud-percent?
| - `weather.{location}_observations` for current weather observations | ||
| - `weather.{location}_forecast` for the weather forecast |
There was a problem hiding this comment.
| - `weather.{location}_observations` for current weather observations | |
| - `weather.{location}_forecast` for the weather forecast | |
| - `weather.weer_{location}_observations` for current weather observations | |
| - `weather.weer_{location}_forecast` for the weather forecast |

Summary
This PR adds complete support for KNMI observation data by introducing ten new weather sensors with proper Home Assistant integration. It reuses data already available in the integration to expose separate sensors, and includes a smart cloud‑coverage calculation plus a 16‑point cardinal wind‑direction ENUM with translations.
New Sensors
Technical Implementation
NLObservationRangeSensorclass eliminates code duplication for standard observations