fix(utils): widen wind_dir_to_text param to float | str | None

The azimut value_from_data_fn now passes dir.get(WIND_DIR) (typed Any | None),
which tripped basedpyright reportArgumentType against the float-only signature.
The body already coerces via to_float() and handles None, so widen the
annotation to match the real inputs (raw str payload, float, or None).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SchiZzA 2026-06-21 12:53:46 +02:00
parent 50d0e9fae7
commit acda94bb03
No known key found for this signature in database
1 changed files with 4 additions and 3 deletions

View File

@ -188,11 +188,12 @@ def check_disabled(items: dict[str, str], config_entry: ConfigEntry) -> list[str
return missing_sensors if entityFound else None
def wind_dir_to_text(deg: float) -> UnitOfDir | None:
def wind_dir_to_text(deg: float | str | None) -> UnitOfDir | None:
"""Return wind direction in text representation.
A direction of 0 - or a missing/invalid value - is treated as "no reading"
(calm) and returns None, so a missing wind direction does not render as North.
Accepts the raw payload value (str), a float, or None. A direction of 0 - or
a missing/invalid value - is treated as "no reading" (calm) and returns None,
so a missing wind direction does not render as North.
Returns UnitOfDir or None
"""