From acda94bb032dab716b71d632f198ef1dd940201c Mon Sep 17 00:00:00 2001 From: SchiZzA Date: Sun, 21 Jun 2026 12:53:46 +0200 Subject: [PATCH] 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) --- custom_components/sws12500/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/sws12500/utils.py b/custom_components/sws12500/utils.py index d1229ac..595fbb2 100644 --- a/custom_components/sws12500/utils.py +++ b/custom_components/sws12500/utils.py @@ -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 """