From 048bd6bd4c431f910c55537e5cf0eb482c953603 Mon Sep 17 00:00:00 2001 From: SchiZzA Date: Thu, 26 Feb 2026 19:33:36 +0100 Subject: [PATCH] Fix Windy credential validation for None/blank options Normalize Windy station ID and password from config options and require both values before enabling Windy resend. --- custom_components/sws12500/windy_func.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/custom_components/sws12500/windy_func.py b/custom_components/sws12500/windy_func.py index 63ceb1d..4d220c8 100644 --- a/custom_components/sws12500/windy_func.py +++ b/custom_components/sws12500/windy_func.py @@ -139,10 +139,12 @@ class WindyPush: if "t1solrad" in purged_data: purged_data["solarradiation"] = purged_data.pop("t1solrad") - windy_station_id = self.config.options.get(WINDY_STATION_ID, "") - windy_station_pw = self.config.options.get(WINDY_STATION_PW, "") + windy_station_id = (self.config.options.get(WINDY_STATION_ID) or "").strip() + windy_station_pw = (self.config.options.get(WINDY_STATION_PW) or "").strip() - if windy_station_id == "" or windy_station_pw == "": + # Both values are required. Options can sometimes be None, so normalize to + # empty string and strip whitespace before validating. + if not windy_station_id or not windy_station_pw: _LOGGER.error( "Windy ID or PASSWORD is not set correctly. Please reconfigure your WINDY resend credentials. Disabling WINDY resend for now!" )