From 67d8acf9cc183c6bffc060a20e0117b551f124e0 Mon Sep 17 00:00:00 2001 From: SchiZzA Date: Sun, 16 Nov 2025 13:13:41 +0100 Subject: [PATCH 1/6] Add constants for `pocasimeteo_cz` const `POCASI_CZ_URL` added to constants. cont `POCASI_CZ_SEDN_INTERVAL` and POCASI_CZ_SEND_MINIMUM are added to contants. --- custom_components/sws12500/const.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/custom_components/sws12500/const.py b/custom_components/sws12500/const.py index 8ff1897..bb1e78c 100644 --- a/custom_components/sws12500/const.py +++ b/custom_components/sws12500/const.py @@ -9,6 +9,10 @@ WSLINK_URL = "/data/upload.php" WINDY_URL = "https://stations.windy.com/pws/update/" DATABASE_PATH = "/config/home-assistant_v2.db" +POCASI_CZ_URL: Final = "http://ms.pocasimeteo.cz" +POCASI_CZ_SEND_INTERVAL = 30 # default time to resend data +POCASTI_CZ_SEND_MINIMUM: Final = 12 # minimal time to resend data + ICON = "mdi:weather" API_KEY = "API_KEY" From 040f70c02733b3b162d5b9c252a83bf622144bf4 Mon Sep 17 00:00:00 2001 From: SchiZzA Date: Sun, 16 Nov 2025 13:38:11 +0100 Subject: [PATCH 2/6] Adds translation keys. Updated cs.json, en.json, strings,json --- custom_components/sws12500/strings.json | 197 +++++++++++------- .../sws12500/translations/cs.json | 134 +++++++++--- .../sws12500/translations/en.json | 128 +++++++++--- 3 files changed, 322 insertions(+), 137 deletions(-) diff --git a/custom_components/sws12500/strings.json b/custom_components/sws12500/strings.json index 3472af0..7aec226 100644 --- a/custom_components/sws12500/strings.json +++ b/custom_components/sws12500/strings.json @@ -5,7 +5,6 @@ "valid_credentials_key": "Provide valid API KEY.", "valid_credentials_match": "API ID and API KEY should not be the same." }, - "step": { "user": { "description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant", @@ -25,7 +24,6 @@ } } }, - "options": { "error": { "valid_credentials_api": "Provide valid API ID.", @@ -33,7 +31,6 @@ "valid_credentials_match": "API ID and API KEY should not be the same.", "windy_key_required": "Windy API key is required if you want to enable this function." }, - "step": { "init": { "title": "Configure SWS12500 Integration", @@ -43,7 +40,6 @@ "windy": "Windy configuration" } }, - "basic": { "description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant", "title": "Configure credentials", @@ -60,7 +56,6 @@ "WSLINK": "Enable WSLink API if the station is set to send data via WSLink." } }, - "windy": { "description": "Resend weather data to your Windy stations.", "title": "Configure Windy", @@ -74,79 +69,137 @@ "windy_logger_checkbox": "Enable only if you want to send debuging data to the developer." } }, - "migration": { - "title": "Statistic migration.", - "description": "For the correct functioning of long-term statistics, it is necessary to migrate the sensor unit in the long-term statistics. The original unit of long-term statistics for daily precipitation was in mm/d, however, the station only sends data in mm without time differentiation.\n\n The sensor to be migrated is for daily precipitation. If the correct value is already in the list for the daily precipitation sensor (mm), then the migration is already complete.\n\n Migration result for the sensor: {migration_status}, a total of {migration_count} rows converted.", + "pocasi": { + "description": "Resend data to Pocasi Meteo CZ", + "title": "Configure Pocasi Meteo CZ", "data": { - "sensor_to_migrate": "Sensor to migrate", - "trigger_action": "Trigger migration" + "POCASI_API_ID": "ID from your Pocasi Meteo APP", + "POCASI_API_KEY": "Key from your Pocasi Meteo APP", + "POCASI_SEND_INTERVAL": "Resend interval in seconds", + "pocasi_enabled_checkbox": "Enable resending data to Pocasi Meteo", + "pocasi_logger_choeckbox": "Log data and responses" }, "data_description": { - "sensor_to_migrate": "Select the correct sensor for statistics migration.\nThe sensor values will be preserved, they will not be recalculated, only the unit in the long-term statistics will be changed.", - "trigger_action": "Trigger the sensor statistics migration after checking." - } - } - } - }, - - "entity": { - "sensor": { - "indoor_temp": { "name": "Indoor temperature" }, - "indoor_humidity": { "name": "Indoor humidity" }, - "outside_temp": { "name": "Outside Temperature" }, - "outside_humidity": { "name": "Outside humidity" }, - "uv": { "name": "UV index" }, - "baro_pressure": { "name": "Barometric pressure" }, - "dew_point": { "name": "Dew point" }, - "wind_speed": { "name": "Wind speed" }, - "wind_dir": { "name": "Wind direction" }, - "wind_gust": { "name": "Wind gust" }, - "rain": { "name": "Rain" }, - "daily_rain": { "name": "Daily precipitation" }, - "solar_radiation": { "name": "Solar irradiance" }, - "ch2_temp": { "name": "Channel 2 temperature" }, - "ch2_humidity": { "name": "Channel 2 humidity" }, - "ch3_temp": { "name": "Channel 3 temperature" }, - "ch3_humidity": { "name": "Channel 3 humidity" }, - "ch4_temp": { "name": "Channel 4 temperature" }, - "ch4_humidity": { "name": "Channel 4 humidity" }, - "heat_index": { "name": "Apparent temperature" }, - "chill_index": { "name": "Wind chill" }, - "wind_azimut": { - "name": "Bearing", - "state": { - "n": "N", - "nne": "NNE", - "ne": "NE", - "ene": "ENE", - "e": "E", - "ese": "ESE", - "se": "SE", - "sse": "SSE", - "s": "S", - "ssw": "SSW", - "sw": "SW", - "wsw": "WSW", - "w": "W", - "wnw": "WNW", - "nw": "NW", - "nnw": "NNW" + "POCASI_API_ID": "You can obtain your ID in Pocasi Meteo App", + "POCASI_API_KEY": "You can obtain your KEY in Pocasi Meteo App", + "POCASI_SEND_INTERVAL": "Resend interval in seconds (minimum 12s, default 30s)", + "pocasi_enabled_checkbox": "Enables resending data to Pocasi Meteo", + "pocasi_logger_checkbox": "Enable only if you want to send debbug data to the developer" }, - "outside_battery": { - "name": "Outside battery level", - "state": { - "normal": "OK", - "low": "Low", - "unknown": "Unknown / drained out" + "migration": { + "title": "Statistic migration.", + "description": "For the correct functioning of long-term statistics, it is necessary to migrate the sensor unit in the long-term statistics. The original unit of long-term statistics for daily precipitation was in mm/d, however, the station only sends data in mm without time differentiation.\n\n The sensor to be migrated is for daily precipitation. If the correct value is already in the list for the daily precipitation sensor (mm), then the migration is already complete.\n\n Migration result for the sensor: {migration_status}, a total of {migration_count} rows converted.", + "data": { + "sensor_to_migrate": "Sensor to migrate", + "trigger_action": "Trigger migration" + }, + "data_description": { + "sensor_to_migrate": "Select the correct sensor for statistics migration.\nThe sensor values will be preserved, they will not be recalculated, only the unit in the long-term statistics will be changed.", + "trigger_action": "Trigger the sensor statistics migration after checking." } } } - } - }, - "notify": { - "added": { - "title": "New sensors for SWS 12500 found.", - "message": "{added_sensors}\n" + }, + "entity": { + "sensor": { + "indoor_temp": { + "name": "Indoor temperature" + }, + "indoor_humidity": { + "name": "Indoor humidity" + }, + "outside_temp": { + "name": "Outside Temperature" + }, + "outside_humidity": { + "name": "Outside humidity" + }, + "uv": { + "name": "UV index" + }, + "baro_pressure": { + "name": "Barometric pressure" + }, + "dew_point": { + "name": "Dew point" + }, + "wind_speed": { + "name": "Wind speed" + }, + "wind_dir": { + "name": "Wind direction" + }, + "wind_gust": { + "name": "Wind gust" + }, + "rain": { + "name": "Rain" + }, + "daily_rain": { + "name": "Daily precipitation" + }, + "solar_radiation": { + "name": "Solar irradiance" + }, + "ch2_temp": { + "name": "Channel 2 temperature" + }, + "ch2_humidity": { + "name": "Channel 2 humidity" + }, + "ch3_temp": { + "name": "Channel 3 temperature" + }, + "ch3_humidity": { + "name": "Channel 3 humidity" + }, + "ch4_temp": { + "name": "Channel 4 temperature" + }, + "ch4_humidity": { + "name": "Channel 4 humidity" + }, + "heat_index": { + "name": "Apparent temperature" + }, + "chill_index": { + "name": "Wind chill" + }, + "wind_azimut": { + "name": "Bearing", + "state": { + "n": "N", + "nne": "NNE", + "ne": "NE", + "ene": "ENE", + "e": "E", + "ese": "ESE", + "se": "SE", + "sse": "SSE", + "s": "S", + "ssw": "SSW", + "sw": "SW", + "wsw": "WSW", + "w": "W", + "wnw": "WNW", + "nw": "NW", + "nnw": "NNW" + }, + "outside_battery": { + "name": "Outside battery level", + "state": { + "normal": "OK", + "low": "Low", + "unknown": "Unknown / drained out" + } + } + } + } + }, + "notify": { + "added": { + "title": "New sensors for SWS 12500 found.", + "message": "{added_sensors}\n" + } } } -} diff --git a/custom_components/sws12500/translations/cs.json b/custom_components/sws12500/translations/cs.json index 50948ef..0a968d2 100644 --- a/custom_components/sws12500/translations/cs.json +++ b/custom_components/sws12500/translations/cs.json @@ -24,15 +24,15 @@ } } }, - "options": { "error": { "valid_credentials_api": "Vyplňte platné API ID", "valid_credentials_key": "Vyplňte platný API KEY", "valid_credentials_match": "API ID a API KEY nesmějí být stejné!", - "windy_key_required": "Je vyžadován Windy API key, pokud chcete aktivovat přeposílání dat na Windy" + "windy_key_required": "Je vyžadován Windy API key, pokud chcete aktivovat přeposílání dat na Windy", + "pocasi_id_required": "Je vyžadován Počasí ID, pokud chcete aktivovat přeposílání dat na Počasí Meteo CZ", + "pocasi_key_required": "Klíč k účtu Počasí Meteo je povinný." }, - "step": { "init": { "title": "Nastavení integrace SWS12500", @@ -40,10 +40,10 @@ "menu_options": { "basic": "Základní - přístupové údaje (přihlášení)", "windy": "Nastavení pro přeposílání dat na Windy", + "pocasi": "Nastavení pro přeposlání dat na Pošasí Meteo CZ", "migration": "Migrace statistiky senzoru" } }, - "basic": { "description": "Zadejte API ID a API KEY, aby meteostanice mohla komunikovat s HomeAssistantem", "title": "Nastavení přihlášení", @@ -60,7 +60,6 @@ "wslink": "WSLink API zapněte, pokud je stanice nastavena na zasílání dat přes WSLink." } }, - "windy": { "description": "Přeposílání dat z metostanice na Windy", "title": "Konfigurace Windy", @@ -70,10 +69,28 @@ "windy_logger_checkbox": "Logovat data a odpovědi z Windy" }, "data_description": { - "WINDY_API_KEY": "Klíč API KEY získaný z https://https://api.windy.com/keys", + "WINDY_API_KEY": "Klíč API KEY získaný z https://api.windy.com/keys", "windy_logger_checkbox": "Zapnout pouze v případě, že chcete poslat ladící informace vývojáři." } }, + "pocasi": { + "description": "Přeposílání dat do aplikace Počasí Meteo", + "title": "Konfigurace Počasí Meteo", + "data": { + "POCASI_API_ID": "ID účtu na Počasí Meteo", + "POCASI_API_KEY": "Klíč (Key) k účtu Počasí Meteo", + "POCASI_SEND_INTERVAL": "Interval v sekundách", + "pocasi_enabled_checkbox": "Povolit přeposílání dat na server Počasí Meteo", + "pocasi_logger_choeckbox": "Logovat data a odpovědi z Počasí Meteo" + }, + "data_description": { + "POCASI_API_ID": "ID získáte ve své aplikaci Počasí Meteo", + "POCASI_API_KEY": "Klíč (Key) získáte ve své aplikaci Počasí Meteo", + "POCASI_SEND_INTERVAL": "Interval v jakém se mají data na server přeposílat (minimum 12s, defaultně 30s)", + "pocasi_enabled_checkbox": "Zapne přeposílání data na server Počasí Meteo", + "pocasi_logger_checkbox": "Zapnout pouze v případě, že chcete zaslat ladící informace vývojáři." + } + }, "migration": { "title": "Migrace statistiky senzoru.", "description": "Pro správnou funkci dlouhodobé statistiky je nutné provést migraci jednotky senzoru v dlouhodobé statistice. Původní jednotka dlouhodobé statistiky pro denní úhrn srážek byla v mm/d, nicméně stanice zasílá pouze data v mm bez časového rozlišení.\n\n Senzor, který má být migrován je pro denní úhrn srážek. Pokud je v seznamu již správná hodnota u senzoru pro denní úhrn (mm), pak je již migrace hotová.\n\n Výsledek migrace pro senzor: {migration_status}, přepvedeno celkem {migration_count} řádků.", @@ -88,35 +105,86 @@ } } }, - "entity": { "sensor": { - "indoor_temp": { "name": "Vnitřní teplota" }, - "indoor_humidity": { "name": "Vnitřní vlhkost vzduchu" }, - "outside_temp": { "name": "Venkovní teplota" }, - "outside_humidity": { "name": "Venkovní vlhkost vzduchu" }, - "uv": { "name": "UV index" }, - "baro_pressure": { "name": "Tlak vzduchu" }, - "dew_point": { "name": "Rosný bod" }, - "wind_speed": { "name": "Rychlost větru" }, - "wind_dir": { "name": "Směr větru" }, - "wind_gust": { "name": "Poryvy větru" }, - "rain": { "name": "Srážky" }, - "daily_rain": { "name": "Denní úhrn srážek" }, - "solar_radiation": { "name": "Sluneční osvit" }, - "ch2_temp": { "name": "Teplota senzoru 2" }, - "ch2_humidity": { "name": "Vlhkost sensoru 2" }, - "ch3_temp": { "name": "Teplota senzoru 3" }, - "ch3_humidity": { "name": "Vlhkost sensoru 3" }, - "ch4_temp": { "name": "Teplota senzoru 4" }, - "ch4_humidity": { "name": "Vlhkost sensoru 4" }, - "heat_index": { "name": "Tepelný index" }, - "chill_index": { "name": "Pocitová teplota" }, - "hourly_rain": { "name": "Hodinový úhrn srážek" }, - "weekly_rain": { "name": "Týdenní úhrn srážek" }, - "monthly_rain": { "name": "Měsíční úhrn srážek" }, - "yearly_rain": { "name": "Roční úhrn srážek" }, - "wbgt_temp": { "name": "WBGT index" }, + "indoor_temp": { + "name": "Vnitřní teplota" + }, + "indoor_humidity": { + "name": "Vnitřní vlhkost vzduchu" + }, + "outside_temp": { + "name": "Venkovní teplota" + }, + "outside_humidity": { + "name": "Venkovní vlhkost vzduchu" + }, + "uv": { + "name": "UV index" + }, + "baro_pressure": { + "name": "Tlak vzduchu" + }, + "dew_point": { + "name": "Rosný bod" + }, + "wind_speed": { + "name": "Rychlost větru" + }, + "wind_dir": { + "name": "Směr větru" + }, + "wind_gust": { + "name": "Poryvy větru" + }, + "rain": { + "name": "Srážky" + }, + "daily_rain": { + "name": "Denní úhrn srážek" + }, + "solar_radiation": { + "name": "Sluneční osvit" + }, + "ch2_temp": { + "name": "Teplota senzoru 2" + }, + "ch2_humidity": { + "name": "Vlhkost sensoru 2" + }, + "ch3_temp": { + "name": "Teplota senzoru 3" + }, + "ch3_humidity": { + "name": "Vlhkost sensoru 3" + }, + "ch4_temp": { + "name": "Teplota senzoru 4" + }, + "ch4_humidity": { + "name": "Vlhkost sensoru 4" + }, + "heat_index": { + "name": "Tepelný index" + }, + "chill_index": { + "name": "Pocitová teplota" + }, + "hourly_rain": { + "name": "Hodinový úhrn srážek" + }, + "weekly_rain": { + "name": "Týdenní úhrn srážek" + }, + "monthly_rain": { + "name": "Měsíční úhrn srážek" + }, + "yearly_rain": { + "name": "Roční úhrn srážek" + }, + "wbgt_temp": { + "name": "WBGT index" + }, "wind_azimut": { "name": "Azimut", "state": { diff --git a/custom_components/sws12500/translations/en.json b/custom_components/sws12500/translations/en.json index 69317e2..1440367 100644 --- a/custom_components/sws12500/translations/en.json +++ b/custom_components/sws12500/translations/en.json @@ -5,7 +5,6 @@ "valid_credentials_key": "Provide valid API KEY.", "valid_credentials_match": "API ID and API KEY should not be the same." }, - "step": { "user": { "description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant", @@ -25,7 +24,6 @@ } } }, - "options": { "error": { "valid_credentials_api": "Provide valid API ID.", @@ -33,7 +31,6 @@ "valid_credentials_match": "API ID and API KEY should not be the same.", "windy_key_required": "Windy API key is required if you want to enable this function." }, - "step": { "init": { "title": "Configure SWS12500 Integration", @@ -43,7 +40,6 @@ "windy": "Windy configuration" } }, - "basic": { "description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant", "title": "Configure credentials", @@ -60,7 +56,6 @@ "WSLINK": "Enable WSLink API if the station is set to send data via WSLink." } }, - "windy": { "description": "Resend weather data to your Windy stations.", "title": "Configure Windy", @@ -74,6 +69,24 @@ "windy_logger_checkbox": "Enable only if you want to send debuging data to the developer." } }, + "pocasi": { + "description": "Resend data to Pocasi Meteo CZ", + "title": "Configure Pocasi Meteo CZ", + "data": { + "POCASI_API_ID": "ID from your Pocasi Meteo APP", + "POCASI_API_KEY": "Key from your Pocasi Meteo APP", + "POCASI_SEND_INTERVAL": "Resend interval in seconds", + "pocasi_enabled_checkbox": "Enable resending data to Pocasi Meteo", + "pocasi_logger_choeckbox": "Log data and responses" + }, + "data_description": { + "POCASI_API_ID": "You can obtain your ID in Pocasi Meteo App", + "POCASI_API_KEY": "You can obtain your KEY in Pocasi Meteo App", + "POCASI_SEND_INTERVAL": "Resend interval in seconds (minimum 12s, default 30s)", + "pocasi_enabled_checkbox": "Enables resending data to Pocasi Meteo", + "pocasi_logger_checkbox": "Enable only if you want to send debbug data to the developer" + } + }, "migration": { "title": "Statistic migration.", "description": "For the correct functioning of long-term statistics, it is necessary to migrate the sensor unit in the long-term statistics. The original unit of long-term statistics for daily precipitation was in mm/d, however, the station only sends data in mm without time differentiation.\n\n The sensor to be migrated is for daily precipitation. If the correct value is already in the list for the daily precipitation sensor (mm), then the migration is already complete.\n\n Migration result for the sensor: {migration_status}, a total of {migration_count} rows converted.", @@ -88,35 +101,86 @@ } } }, - "entity": { "sensor": { - "indoor_temp": { "name": "Indoor temperature" }, - "indoor_humidity": { "name": "Indoor humidity" }, - "outside_temp": { "name": "Outside Temperature" }, - "outside_humidity": { "name": "Outside humidity" }, - "uv": { "name": "UV index" }, - "baro_pressure": { "name": "Barometric pressure" }, - "dew_point": { "name": "Dew point" }, - "wind_speed": { "name": "Wind speed" }, - "wind_dir": { "name": "Wind direction" }, - "wind_gust": { "name": "Wind gust" }, - "rain": { "name": "Rain" }, - "daily_rain": { "name": "Daily precipitation" }, - "solar_radiation": { "name": "Solar irradiance" }, - "ch2_temp": { "name": "Channel 2 temperature" }, - "ch2_humidity": { "name": "Channel 2 humidity" }, - "ch3_temp": { "name": "Channel 3 temperature" }, - "ch3_humidity": { "name": "Channel 3 humidity" }, - "ch4_temp": { "name": "Channel 4 temperature" }, - "ch4_humidity": { "name": "Channel 4 humidity" }, - "heat_index": { "name": "Apparent temperature" }, - "chill_index": { "name": "Wind chill" }, - "hourly_rain": { "name": "Hourly precipitation" }, - "weekly_rain": { "name": "Weekly precipitation" }, - "monthly_rain": { "name": "Monthly precipitation" }, - "yearly_rain": { "name": "Yearly precipitation" }, - "wbgt_index": { "name": "WBGT index" }, + "indoor_temp": { + "name": "Indoor temperature" + }, + "indoor_humidity": { + "name": "Indoor humidity" + }, + "outside_temp": { + "name": "Outside Temperature" + }, + "outside_humidity": { + "name": "Outside humidity" + }, + "uv": { + "name": "UV index" + }, + "baro_pressure": { + "name": "Barometric pressure" + }, + "dew_point": { + "name": "Dew point" + }, + "wind_speed": { + "name": "Wind speed" + }, + "wind_dir": { + "name": "Wind direction" + }, + "wind_gust": { + "name": "Wind gust" + }, + "rain": { + "name": "Rain" + }, + "daily_rain": { + "name": "Daily precipitation" + }, + "solar_radiation": { + "name": "Solar irradiance" + }, + "ch2_temp": { + "name": "Channel 2 temperature" + }, + "ch2_humidity": { + "name": "Channel 2 humidity" + }, + "ch3_temp": { + "name": "Channel 3 temperature" + }, + "ch3_humidity": { + "name": "Channel 3 humidity" + }, + "ch4_temp": { + "name": "Channel 4 temperature" + }, + "ch4_humidity": { + "name": "Channel 4 humidity" + }, + "heat_index": { + "name": "Apparent temperature" + }, + "chill_index": { + "name": "Wind chill" + }, + "hourly_rain": { + "name": "Hourly precipitation" + }, + "weekly_rain": { + "name": "Weekly precipitation" + }, + "monthly_rain": { + "name": "Monthly precipitation" + }, + "yearly_rain": { + "name": "Yearly precipitation" + }, + "wbgt_index": { + "name": "WBGT index" + }, "wind_azimut": { "name": "Bearing", "state": { From 92eadbb4e243fcebbc132f3f0bf8004d8909a193 Mon Sep 17 00:00:00 2001 From: SchiZzA Date: Sun, 16 Nov 2025 14:08:27 +0100 Subject: [PATCH 3/6] Typo update --- custom_components/sws12500/strings.json | 227 +++++++++--------- .../sws12500/translations/cs.json | 2 +- .../sws12500/translations/en.json | 2 +- 3 files changed, 116 insertions(+), 115 deletions(-) diff --git a/custom_components/sws12500/strings.json b/custom_components/sws12500/strings.json index 7aec226..7e87bea 100644 --- a/custom_components/sws12500/strings.json +++ b/custom_components/sws12500/strings.json @@ -77,7 +77,7 @@ "POCASI_API_KEY": "Key from your Pocasi Meteo APP", "POCASI_SEND_INTERVAL": "Resend interval in seconds", "pocasi_enabled_checkbox": "Enable resending data to Pocasi Meteo", - "pocasi_logger_choeckbox": "Log data and responses" + "pocasi_logger_checkbox": "Log data and responses" }, "data_description": { "POCASI_API_ID": "You can obtain your ID in Pocasi Meteo App", @@ -85,121 +85,122 @@ "POCASI_SEND_INTERVAL": "Resend interval in seconds (minimum 12s, default 30s)", "pocasi_enabled_checkbox": "Enables resending data to Pocasi Meteo", "pocasi_logger_checkbox": "Enable only if you want to send debbug data to the developer" - }, - "migration": { - "title": "Statistic migration.", - "description": "For the correct functioning of long-term statistics, it is necessary to migrate the sensor unit in the long-term statistics. The original unit of long-term statistics for daily precipitation was in mm/d, however, the station only sends data in mm without time differentiation.\n\n The sensor to be migrated is for daily precipitation. If the correct value is already in the list for the daily precipitation sensor (mm), then the migration is already complete.\n\n Migration result for the sensor: {migration_status}, a total of {migration_count} rows converted.", - "data": { - "sensor_to_migrate": "Sensor to migrate", - "trigger_action": "Trigger migration" - }, - "data_description": { - "sensor_to_migrate": "Select the correct sensor for statistics migration.\nThe sensor values will be preserved, they will not be recalculated, only the unit in the long-term statistics will be changed.", - "trigger_action": "Trigger the sensor statistics migration after checking." - } } - } - }, - "entity": { - "sensor": { - "indoor_temp": { - "name": "Indoor temperature" + }, + "migration": { + "title": "Statistic migration.", + "description": "For the correct functioning of long-term statistics, it is necessary to migrate the sensor unit in the long-term statistics. The original unit of long-term statistics for daily precipitation was in mm/d, however, the station only sends data in mm without time differentiation.\n\n The sensor to be migrated is for daily precipitation. If the correct value is already in the list for the daily precipitation sensor (mm), then the migration is already complete.\n\n Migration result for the sensor: {migration_status}, a total of {migration_count} rows converted.", + "data": { + "sensor_to_migrate": "Sensor to migrate", + "trigger_action": "Trigger migration" }, - "indoor_humidity": { - "name": "Indoor humidity" - }, - "outside_temp": { - "name": "Outside Temperature" - }, - "outside_humidity": { - "name": "Outside humidity" - }, - "uv": { - "name": "UV index" - }, - "baro_pressure": { - "name": "Barometric pressure" - }, - "dew_point": { - "name": "Dew point" - }, - "wind_speed": { - "name": "Wind speed" - }, - "wind_dir": { - "name": "Wind direction" - }, - "wind_gust": { - "name": "Wind gust" - }, - "rain": { - "name": "Rain" - }, - "daily_rain": { - "name": "Daily precipitation" - }, - "solar_radiation": { - "name": "Solar irradiance" - }, - "ch2_temp": { - "name": "Channel 2 temperature" - }, - "ch2_humidity": { - "name": "Channel 2 humidity" - }, - "ch3_temp": { - "name": "Channel 3 temperature" - }, - "ch3_humidity": { - "name": "Channel 3 humidity" - }, - "ch4_temp": { - "name": "Channel 4 temperature" - }, - "ch4_humidity": { - "name": "Channel 4 humidity" - }, - "heat_index": { - "name": "Apparent temperature" - }, - "chill_index": { - "name": "Wind chill" - }, - "wind_azimut": { - "name": "Bearing", - "state": { - "n": "N", - "nne": "NNE", - "ne": "NE", - "ene": "ENE", - "e": "E", - "ese": "ESE", - "se": "SE", - "sse": "SSE", - "s": "S", - "ssw": "SSW", - "sw": "SW", - "wsw": "WSW", - "w": "W", - "wnw": "WNW", - "nw": "NW", - "nnw": "NNW" - }, - "outside_battery": { - "name": "Outside battery level", - "state": { - "normal": "OK", - "low": "Low", - "unknown": "Unknown / drained out" - } - } + "data_description": { + "sensor_to_migrate": "Select the correct sensor for statistics migration.\nThe sensor values will be preserved, they will not be recalculated, only the unit in the long-term statistics will be changed.", + "trigger_action": "Trigger the sensor statistics migration after checking." } } - }, - "notify": { - "added": { - "title": "New sensors for SWS 12500 found.", - "message": "{added_sensors}\n" - } + } + }, + "entity": { + "sensor": { + "indoor_temp": { + "name": "Indoor temperature" + }, + "indoor_humidity": { + "name": "Indoor humidity" + }, + "outside_temp": { + "name": "Outside Temperature" + }, + "outside_humidity": { + "name": "Outside humidity" + }, + "uv": { + "name": "UV index" + }, + "baro_pressure": { + "name": "Barometric pressure" + }, + "dew_point": { + "name": "Dew point" + }, + "wind_speed": { + "name": "Wind speed" + }, + "wind_dir": { + "name": "Wind direction" + }, + "wind_gust": { + "name": "Wind gust" + }, + "rain": { + "name": "Rain" + }, + "daily_rain": { + "name": "Daily precipitation" + }, + "solar_radiation": { + "name": "Solar irradiance" + }, + "ch2_temp": { + "name": "Channel 2 temperature" + }, + "ch2_humidity": { + "name": "Channel 2 humidity" + }, + "ch3_temp": { + "name": "Channel 3 temperature" + }, + "ch3_humidity": { + "name": "Channel 3 humidity" + }, + "ch4_temp": { + "name": "Channel 4 temperature" + }, + "ch4_humidity": { + "name": "Channel 4 humidity" + }, + "heat_index": { + "name": "Apparent temperature" + }, + "chill_index": { + "name": "Wind chill" + }, + "wind_azimut": { + "name": "Bearing", + "state": { + "n": "N", + "nne": "NNE", + "ne": "NE", + "ene": "ENE", + "e": "E", + "ese": "ESE", + "se": "SE", + "sse": "SSE", + "s": "S", + "ssw": "SSW", + "sw": "SW", + "wsw": "WSW", + "w": "W", + "wnw": "WNW", + "nw": "NW", + "nnw": "NNW" + }, + "outside_battery": { + "name": "Outside battery level", + "state": { + "normal": "OK", + "low": "Low", + "unknown": "Unknown / drained out" + } + } + } + } + }, + "notify": { + "added": { + "title": "New sensors for SWS 12500 found.", + "message": "{added_sensors}\n" } } +} diff --git a/custom_components/sws12500/translations/cs.json b/custom_components/sws12500/translations/cs.json index 0a968d2..a612f6e 100644 --- a/custom_components/sws12500/translations/cs.json +++ b/custom_components/sws12500/translations/cs.json @@ -81,7 +81,7 @@ "POCASI_API_KEY": "Klíč (Key) k účtu Počasí Meteo", "POCASI_SEND_INTERVAL": "Interval v sekundách", "pocasi_enabled_checkbox": "Povolit přeposílání dat na server Počasí Meteo", - "pocasi_logger_choeckbox": "Logovat data a odpovědi z Počasí Meteo" + "pocasi_logger_checkbox": "Logovat data a odpovědi z Počasí Meteo" }, "data_description": { "POCASI_API_ID": "ID získáte ve své aplikaci Počasí Meteo", diff --git a/custom_components/sws12500/translations/en.json b/custom_components/sws12500/translations/en.json index 1440367..09b60cd 100644 --- a/custom_components/sws12500/translations/en.json +++ b/custom_components/sws12500/translations/en.json @@ -77,7 +77,7 @@ "POCASI_API_KEY": "Key from your Pocasi Meteo APP", "POCASI_SEND_INTERVAL": "Resend interval in seconds", "pocasi_enabled_checkbox": "Enable resending data to Pocasi Meteo", - "pocasi_logger_choeckbox": "Log data and responses" + "pocasi_logger_checkbox": "Log data and responses" }, "data_description": { "POCASI_API_ID": "You can obtain your ID in Pocasi Meteo App", From 0d47e148346a1c0caf4d86e4c32496b230a65701 Mon Sep 17 00:00:00 2001 From: SchiZzA Date: Sun, 16 Nov 2025 15:37:13 +0100 Subject: [PATCH 4/6] =?UTF-8?q?Add=20Po=C4=8Das=C3=AD=20Meteo=20CZ=20integ?= =?UTF-8?q?ration=20to=20options=20flow=20and=20constants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce new config step for Počasí Meteo CZ with validation and UI schema. Define related constants and translation keys for setting up data forwarding. --- custom_components/sws12500/config_flow.py | 90 +++++++++++++++++-- custom_components/sws12500/const.py | 16 +++- .../sws12500/translations/cs.json | 13 +-- 3 files changed, 104 insertions(+), 15 deletions(-) diff --git a/custom_components/sws12500/config_flow.py b/custom_components/sws12500/config_flow.py index 0717ccf..dade542 100644 --- a/custom_components/sws12500/config_flow.py +++ b/custom_components/sws12500/config_flow.py @@ -4,7 +4,7 @@ from typing import Any import voluptuous as vol -from homeassistant.config_entries import ConfigFlow, OptionsFlow +from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow from homeassistant.core import callback from homeassistant.exceptions import HomeAssistantError @@ -14,6 +14,12 @@ from .const import ( DEV_DBG, DOMAIN, INVALID_CREDENTIALS, + POCASI_CZ_API_ID, + POCASI_CZ_API_KEY, + POCASI_CZ_ENABLED, + POCASI_CZ_LOGGER_ENABLED, + POCASI_CZ_SEND_INTERVAL, + POCASI_CZ_SEND_MINIMUM, SENSORS_TO_LOAD, WINDY_API_KEY, WINDY_ENABLED, @@ -43,6 +49,8 @@ class ConfigOptionsFlowHandler(OptionsFlow): self.user_data_schema = {} self.sensors: dict[str, Any] = {} self.migrate_schema = {} + self.pocasi_cz: dict[str, Any] = {} + self.pocasi_cz_schema = {} @property def config_entry(self): @@ -51,7 +59,7 @@ class ConfigOptionsFlowHandler(OptionsFlow): async def _get_entry_data(self): """Get entry data.""" - self.user_data: dict[str, Any] = { + self.user_data = { API_ID: self.config_entry.options.get(API_ID), API_KEY: self.config_entry.options.get(API_KEY), WSLINK: self.config_entry.options.get(WSLINK, False), @@ -65,7 +73,7 @@ class ConfigOptionsFlowHandler(OptionsFlow): vol.Optional(DEV_DBG, default=self.user_data.get(DEV_DBG, False)): bool, } - self.sensors: dict[str, Any] = { + self.sensors = { SENSORS_TO_LOAD: ( self.config_entry.options.get(SENSORS_TO_LOAD) if isinstance(self.config_entry.options.get(SENSORS_TO_LOAD), list) @@ -73,7 +81,7 @@ class ConfigOptionsFlowHandler(OptionsFlow): ) } - self.windy_data: dict[str, Any] = { + self.windy_data = { WINDY_API_KEY: self.config_entry.options.get(WINDY_API_KEY), WINDY_ENABLED: self.config_entry.options.get(WINDY_ENABLED, False), WINDY_LOGGER_ENABLED: self.config_entry.options.get( @@ -90,13 +98,46 @@ class ConfigOptionsFlowHandler(OptionsFlow): vol.Optional( WINDY_LOGGER_ENABLED, default=self.windy_data[WINDY_LOGGER_ENABLED], - ): bool - or False, + ): bool or False, + } + + self.pocasi_cz = { + POCASI_CZ_API_ID: self.config_entry.options.get(POCASI_CZ_API_ID, ""), + POCASI_CZ_API_KEY: self.config_entry.options.get(POCASI_CZ_API_KEY, ""), + POCASI_CZ_ENABLED: self.config_entry.options.get(POCASI_CZ_ENABLED, False), + POCASI_CZ_LOGGER_ENABLED: self.config_entry.options.get( + POCASI_CZ_LOGGER_ENABLED, False + ), + POCASI_CZ_SEND_INTERVAL: self.config_entry.options.get( + POCASI_CZ_SEND_INTERVAL, 30 + ), + } + + self.pocasi_cz_schema = { + vol.Required( + POCASI_CZ_API_ID, default=self.pocasi_cz.get(POCASI_CZ_API_ID) + ): str, + vol.Required( + POCASI_CZ_API_KEY, default=self.pocasi_cz.get(POCASI_CZ_API_KEY) + ): str, + vol.Required( + POCASI_CZ_SEND_INTERVAL, + default=self.pocasi_cz.get(POCASI_CZ_SEND_INTERVAL), + ): int, + vol.Optional( + POCASI_CZ_ENABLED, default=self.pocasi_cz.get(POCASI_CZ_ENABLED) + ): bool, + vol.Optional( + POCASI_CZ_LOGGER_ENABLED, + default=self.pocasi_cz.get(POCASI_CZ_LOGGER_ENABLED), + ): bool, } async def async_step_init(self, user_input=None): """Manage the options - show menu first.""" - return self.async_show_menu(step_id="init", menu_options=["basic", "windy"]) + return self.async_show_menu( + step_id="init", menu_options=["basic", "windy", "pocasi"] + ) async def async_step_basic(self, user_input=None): """Manage basic options - credentials.""" @@ -124,6 +165,9 @@ class ConfigOptionsFlowHandler(OptionsFlow): # retain sensors user_input.update(self.sensors) + # retain pocasi data + user_input.update(self.pocasi_cz) + return self.async_create_entry(title=DOMAIN, data=user_input) self.user_data = user_input @@ -164,6 +208,38 @@ class ConfigOptionsFlowHandler(OptionsFlow): return self.async_create_entry(title=DOMAIN, data=user_input) + async def async_step_pocasi(self, user_input: Any = None) -> ConfigFlowResult: + """Handle the pocasi step.""" + + errors = {} + + await self._get_entry_data() + + if user_input is None: + return self.async_show_form( + step_id="pocasi", + data_schema=vol.Schema(self.pocasi_cz_schema), + errors=errors, + ) + + if user_input.get(POCASI_CZ_SEND_INTERVAL, 0) < POCASI_CZ_SEND_MINIMUM: + errors[POCASI_CZ_SEND_INTERVAL] = "pocasi_send_minimum" + + if user_input.get(POCASI_CZ_ENABLED): + if user_input.get(POCASI_CZ_API_ID) == "": + errors[POCASI_CZ_API_ID] = "pocasi_id_required" + if user_input.get(POCASI_CZ_API_KEY) == "": + errors[POCASI_CZ_API_KEY] = "pocasi_key_required" + + if len(errors) > 0: + return self.async_show_form( + step_id="pocasi", + data_schema=vol.Schema(self.pocasi_cz_schema), + errors=errors, + ) + + return self.async_create_entry(title=DOMAIN, data=user_input) + class ConfigFlow(ConfigFlow, domain=DOMAIN): """Handle a config flow for Sencor SWS 12500 Weather Station.""" diff --git a/custom_components/sws12500/const.py b/custom_components/sws12500/const.py index bb1e78c..3ed2565 100644 --- a/custom_components/sws12500/const.py +++ b/custom_components/sws12500/const.py @@ -10,8 +10,7 @@ WINDY_URL = "https://stations.windy.com/pws/update/" DATABASE_PATH = "/config/home-assistant_v2.db" POCASI_CZ_URL: Final = "http://ms.pocasimeteo.cz" -POCASI_CZ_SEND_INTERVAL = 30 # default time to resend data -POCASTI_CZ_SEND_MINIMUM: Final = 12 # minimal time to resend data +POCASI_CZ_SEND_MINIMUM: Final = 12 # minimal time to resend data ICON = "mdi:weather" @@ -24,6 +23,19 @@ SENSOR_TO_MIGRATE: Final = "sensor_to_migrate" DEV_DBG: Final = "dev_debug_checkbox" WSLINK: Final = "wslink" +POCASI_CZ_API_KEY = "POCASI_CZ_API_KEY" +POCASI_CZ_API_ID = "POCASI_CZ_API_ID" +POCASI_CZ_SEND_INTERVAL = "POCASI_SEND_INTERVAL" +POCASI_CZ_ENABLED = "pocasi_enabled_chcekbox" +POCASI_CZ_LOGGER_ENABLED = "pocasi_logger_checkbox" +POCASI_INVALID_KEY: Final = ( + "Pocasi Meteo refused to accept data. Invalid ID/Key combination?" +) +POCASI_CZ_SUCCESS: Final = "Successfully sent data to Pocasi Meteo" +POCASI_CZ_UNEXPECTED: Final = ( + "Pocasti Meteo responded unexpectedly 3 times in row. Resendig is now disabled!" +) + WINDY_API_KEY = "WINDY_API_KEY" WINDY_ENABLED: Final = "windy_enabled_checkbox" WINDY_LOGGER_ENABLED: Final = "windy_logger_checkbox" diff --git a/custom_components/sws12500/translations/cs.json b/custom_components/sws12500/translations/cs.json index a612f6e..3b7c9dc 100644 --- a/custom_components/sws12500/translations/cs.json +++ b/custom_components/sws12500/translations/cs.json @@ -31,7 +31,8 @@ "valid_credentials_match": "API ID a API KEY nesmějí být stejné!", "windy_key_required": "Je vyžadován Windy API key, pokud chcete aktivovat přeposílání dat na Windy", "pocasi_id_required": "Je vyžadován Počasí ID, pokud chcete aktivovat přeposílání dat na Počasí Meteo CZ", - "pocasi_key_required": "Klíč k účtu Počasí Meteo je povinný." + "pocasi_key_required": "Klíč k účtu Počasí Meteo je povinný.", + "pocasi_send_minimum": "Minimální interval pro přeposílání je 12 sekund." }, "step": { "init": { @@ -40,7 +41,7 @@ "menu_options": { "basic": "Základní - přístupové údaje (přihlášení)", "windy": "Nastavení pro přeposílání dat na Windy", - "pocasi": "Nastavení pro přeposlání dat na Pošasí Meteo CZ", + "pocasi": "Nastavení pro přeposlání dat na Počasí Meteo CZ", "migration": "Migrace statistiky senzoru" } }, @@ -77,10 +78,10 @@ "description": "Přeposílání dat do aplikace Počasí Meteo", "title": "Konfigurace Počasí Meteo", "data": { - "POCASI_API_ID": "ID účtu na Počasí Meteo", - "POCASI_API_KEY": "Klíč (Key) k účtu Počasí Meteo", - "POCASI_SEND_INTERVAL": "Interval v sekundách", - "pocasi_enabled_checkbox": "Povolit přeposílání dat na server Počasí Meteo", + "POCASI_CZ_API_ID": "ID účtu na Počasí Meteo", + "POCASI_CZ_API_KEY": "Klíč (Key) k účtu Počasí Meteo", + "POCASI_CZ_SEND_INTERVAL": "Interval v sekundách", + "pocasi_enabled_chcekbox": "Povolit přeposílání dat na server Počasí Meteo", "pocasi_logger_checkbox": "Logovat data a odpovědi z Počasí Meteo" }, "data_description": { From 7950e1be462f44cbf32400869460f467d92b2249 Mon Sep 17 00:00:00 2001 From: SchiZzA Date: Sun, 16 Nov 2025 18:37:01 +0100 Subject: [PATCH 5/6] Add Pocasi CZ push to server support Added `pocasi_cz.py` component to handle resending data to Pocasi CZ server. --- custom_components/sws12500/__init__.py | 6 + custom_components/sws12500/const.py | 7 ++ custom_components/sws12500/pocasti_cz.py | 143 +++++++++++++++++++++++ custom_components/sws12500/windy_func.py | 2 +- 4 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 custom_components/sws12500/pocasti_cz.py diff --git a/custom_components/sws12500/__init__.py b/custom_components/sws12500/__init__.py index f7f1f45..f734551 100644 --- a/custom_components/sws12500/__init__.py +++ b/custom_components/sws12500/__init__.py @@ -17,11 +17,13 @@ from .const import ( DEFAULT_URL, DEV_DBG, DOMAIN, + POCASI_CZ_ENABLED, SENSORS_TO_LOAD, WINDY_ENABLED, WSLINK, WSLINK_URL, ) +from .pocasti_cz import PocasiPush from .routes import Routes, unregistred from .utils import ( anonymize, @@ -51,6 +53,7 @@ class WeatherDataUpdateCoordinator(DataUpdateCoordinator): self.hass = hass self.config = config self.windy = WindyPush(hass, config) + self.pocasi: PocasiPush = PocasiPush(hass, config) super().__init__(hass, _LOGGER, name=DOMAIN) async def recieved_data(self, webdata): @@ -85,6 +88,9 @@ class WeatherDataUpdateCoordinator(DataUpdateCoordinator): if self.config_entry.options.get(WINDY_ENABLED): response = await self.windy.push_data_to_windy(data) + if self.config.options.get(POCASI_CZ_ENABLED): + await self.pocasi.push_data_to_server(data, "WSLINK" if _wslink else "WU") + remaped_items = ( remap_wslink_items(data) if self.config_entry.options.get(WSLINK) diff --git a/custom_components/sws12500/const.py b/custom_components/sws12500/const.py index 3ed2565..3fd2298 100644 --- a/custom_components/sws12500/const.py +++ b/custom_components/sws12500/const.py @@ -73,6 +73,13 @@ PURGE_DATA: Final = [ "dailyrainin", ] +PURGE_DATA_POCAS: Final = [ + "ID", + "PASSWORD", + "action", + "rtfreq", +] + BARO_PRESSURE: Final = "baro_pressure" OUTSIDE_TEMP: Final = "outside_temp" diff --git a/custom_components/sws12500/pocasti_cz.py b/custom_components/sws12500/pocasti_cz.py new file mode 100644 index 0000000..1df93ee --- /dev/null +++ b/custom_components/sws12500/pocasti_cz.py @@ -0,0 +1,143 @@ +"""Pocasi CZ resend functions.""" + +from datetime import datetime, timedelta +import logging +from typing import Any, Literal + +from aiohttp import ClientError + +from homeassistant.config_entries import ConfigEntry +from homeassistant.core import HomeAssistant +from homeassistant.helpers.aiohttp_client import async_get_clientsession + +from .const import ( + DEFAULT_URL, + POCASI_CZ_API_ID, + POCASI_CZ_API_KEY, + POCASI_CZ_ENABLED, + POCASI_CZ_LOGGER_ENABLED, + POCASI_CZ_SEND_INTERVAL, + POCASI_CZ_SUCCESS, + POCASI_CZ_UNEXPECTED, + POCASI_CZ_URL, + POCASI_INVALID_KEY, + WSLINK_URL, +) +from .utils import update_options + +_LOGGER = logging.getLogger(__name__) + + +class PocasiNotInserted(Exception): + """NotInserted state.""" + + +class PocasiSuccess(Exception): + """WindySucces state.""" + + +class PocasiApiKeyError(Exception): + """Windy API Key error.""" + + +class PocasiPush: + """Push data to Windy.""" + + def __init__(self, hass: HomeAssistant, config: ConfigEntry) -> None: + """Init.""" + self.hass = hass + self.config = config + self._interval = int(self.config.options.get(POCASI_CZ_SEND_INTERVAL, 30)) + + self.last_update = datetime.now() + self.next_update = datetime.now() + timedelta(seconds=self._interval) + + self.log = self.config.options.get(POCASI_CZ_LOGGER_ENABLED) + self.invalid_response_count = 0 + + def verify_response( + self, + response: str, + ) -> PocasiNotInserted | PocasiSuccess | PocasiApiKeyError | None: + """Verify answer form server.""" + + if self.log: + _LOGGER.debug("Pocasi CZ responded: %s", response) + + # Server does not provide any responses. + # This is placeholder if future state is changed + + return None + + async def push_data_to_server( + self, data: dict[str, Any], mode: Literal["WU", "WSLINK"] + ): + """Pushes weather data to server.""" + + _data = data.copy() + _api_id = self.config.options.get(POCASI_CZ_API_ID) + _api_key = self.config.options.get(POCASI_CZ_API_KEY) + + if self.log: + _LOGGER.info( + "Pocasi CZ last update = %s, next update at: %s", + str(self.last_update), + str(self.next_update), + ) + + if self.next_update > datetime.now(): + _LOGGER.debug( + "Triggered update interval limit of %s seconds. Next possilbe update is set to: %s", + self._interval, + self.next_update, + ) + return False + + request_url: str = "" + if mode == "WSLINK": + _data["wsid"] = _api_id + _data["wspw"] = _api_key + request_url = f"{POCASI_CZ_URL}{WSLINK_URL}" + + if mode == "WU": + _data["ID"] = _api_id + _data["PASSWORD"] = _api_key + request_url = f"{POCASI_CZ_URL}{DEFAULT_URL}" + + session = async_get_clientsession(self.hass, verify_ssl=False) + _LOGGER.debug( + "Payload for Pocasi Meteo server: [mode=%s] [request_url=%s] = %s", + mode, + request_url, + _data, + ) + try: + async with session.get(request_url, params=_data) as resp: + status = await resp.text() + try: + self.verify_response(status) + + except PocasiApiKeyError: + # log despite of settings + _LOGGER.critical(POCASI_INVALID_KEY) + await update_options( + self.hass, self.config, POCASI_CZ_ENABLED, False + ) + except PocasiSuccess: + if self.log: + _LOGGER.info(POCASI_CZ_SUCCESS) + + except ClientError as ex: + _LOGGER.critical("Invalid response from Pocasi Meteo: %s", str(ex)) + self.invalid_response_count += 1 + if self.invalid_response_count > 3: + _LOGGER.critical(POCASI_CZ_UNEXPECTED) + await update_options(self.hass, self.config, POCASI_CZ_ENABLED, False) + + self.last_update = datetime.now() + self.next_update = datetime.now() + timedelta(seconds=self._interval) + + if self.log: + _LOGGER.info("Next update: %s", str(self.next_update)) + + return None diff --git a/custom_components/sws12500/windy_func.py b/custom_components/sws12500/windy_func.py index 47ba8d2..15cf2aa 100644 --- a/custom_components/sws12500/windy_func.py +++ b/custom_components/sws12500/windy_func.py @@ -106,7 +106,7 @@ class WindyPush: if self.next_update > datetime.now(): return False - purged_data = dict(data) + purged_data = data.copy() for purge in PURGE_DATA: if purge in purged_data: From de346ed914aeb819889762cb897d3d07a51ca10a Mon Sep 17 00:00:00 2001 From: SchiZzA Date: Sun, 16 Nov 2025 19:02:24 +0100 Subject: [PATCH 6/6] Fix: Retain dat for other options, while configuring Pocasi CZ --- custom_components/sws12500/config_flow.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/custom_components/sws12500/config_flow.py b/custom_components/sws12500/config_flow.py index dade542..60c3b83 100644 --- a/custom_components/sws12500/config_flow.py +++ b/custom_components/sws12500/config_flow.py @@ -206,6 +206,10 @@ class ConfigOptionsFlowHandler(OptionsFlow): # retain senors user_input.update(self.sensors) + # retain pocasi cz + + user_input.update(self.pocasi_cz) + return self.async_create_entry(title=DOMAIN, data=user_input) async def async_step_pocasi(self, user_input: Any = None) -> ConfigFlowResult: @@ -237,11 +241,19 @@ class ConfigOptionsFlowHandler(OptionsFlow): data_schema=vol.Schema(self.pocasi_cz_schema), errors=errors, ) + # retain user data + user_input.update(self.user_data) + + # retain senors + user_input.update(self.sensors) + + # retain windy + user_input.update(self.windy_data) return self.async_create_entry(title=DOMAIN, data=user_input) -class ConfigFlow(ConfigFlow, domain=DOMAIN): +class ConfigFlowHandler(ConfigFlow, domain=DOMAIN): """Handle a config flow for Sencor SWS 12500 Weather Station.""" data_schema = {