Merge pull request #51 from schizza/config_flow_fix
Improves configuration defaults and UI descriptions Sets default values for optional fields in configuration flow Enhances descriptions and titles in UI for better clarity Updates translationspull/52/head
commit
c131eddf39
|
|
@ -53,15 +53,15 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
|||
self.user_data: dict[str, Any] = {
|
||||
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),
|
||||
DEV_DBG: self.config_entry.options.get(DEV_DBG),
|
||||
WSLINK: self.config_entry.options.get(WSLINK, False),
|
||||
DEV_DBG: self.config_entry.options.get(DEV_DBG, False),
|
||||
}
|
||||
|
||||
self.user_data_schema = {
|
||||
vol.Required(API_ID, default=self.user_data[API_ID] or ""): str,
|
||||
vol.Required(API_KEY, default=self.user_data[API_KEY] or ""): str,
|
||||
vol.Optional(WSLINK, default=self.user_data[WSLINK]): bool,
|
||||
vol.Optional(DEV_DBG, default=self.user_data[DEV_DBG]): bool,
|
||||
vol.Optional(WSLINK, default=self.user_data[WSLINK]): bool or False,
|
||||
vol.Optional(DEV_DBG, default=self.user_data[DEV_DBG]): bool or False,
|
||||
}
|
||||
|
||||
self.sensors: dict[str, Any] = {
|
||||
|
|
@ -72,23 +72,22 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
|||
|
||||
self.windy_data: dict[str, Any] = {
|
||||
WINDY_API_KEY: self.config_entry.options.get(WINDY_API_KEY),
|
||||
WINDY_ENABLED: self.config_entry.options.get(WINDY_ENABLED)
|
||||
if isinstance(self.config_entry.options.get(WINDY_ENABLED), bool)
|
||||
else False,
|
||||
WINDY_LOGGER_ENABLED: self.config_entry.options.get(WINDY_LOGGER_ENABLED)
|
||||
if isinstance(self.config_entry.options.get(WINDY_LOGGER_ENABLED), bool)
|
||||
else False,
|
||||
WINDY_ENABLED: self.config_entry.options.get(WINDY_ENABLED, False),
|
||||
WINDY_LOGGER_ENABLED: self.config_entry.options.get(
|
||||
WINDY_LOGGER_ENABLED, False
|
||||
),
|
||||
}
|
||||
|
||||
self.windy_data_schema = {
|
||||
vol.Optional(
|
||||
WINDY_API_KEY, default=self.windy_data[WINDY_API_KEY] or ""
|
||||
): str,
|
||||
vol.Optional(WINDY_ENABLED, default=self.windy_data[WINDY_ENABLED]): bool,
|
||||
vol.Optional(WINDY_ENABLED, default=self.windy_data[WINDY_ENABLED]): bool
|
||||
or False,
|
||||
vol.Optional(
|
||||
WINDY_LOGGER_ENABLED,
|
||||
default=self.windy_data[WINDY_LOGGER_ENABLED],
|
||||
): bool,
|
||||
): bool or False,
|
||||
}
|
||||
|
||||
async def async_step_init(self, user_input=None):
|
||||
|
|
@ -150,10 +149,6 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
|||
return self.async_show_form(
|
||||
step_id="windy",
|
||||
data_schema=self.windy_data_schema,
|
||||
description_placeholders={
|
||||
WINDY_ENABLED: True,
|
||||
WINDY_LOGGER_ENABLED: user_input[WINDY_LOGGER_ENABLED],
|
||||
},
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,21 +5,27 @@
|
|||
"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",
|
||||
"title": "Configure access for Weather Station",
|
||||
"data": {
|
||||
"API_ID": "API ID / Station ID",
|
||||
"API_KEY": "API KEY / Password",
|
||||
"WSLINK": "WSLink API",
|
||||
"dev_debug_checkbox": "Developer log"
|
||||
},
|
||||
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
||||
"title": "Configure access for Weather Station",
|
||||
"data_description": {
|
||||
"dev_debug_checkbox": " Enable only if you want to send debuging data to the developer."
|
||||
"dev_debug_checkbox": " Enable only if you want to send debuging data to the developer.",
|
||||
"API_ID": "API ID is the Station ID you set in the Weather Station.",
|
||||
"API_KEY": "API KEY is the password you set in the Weather Station.",
|
||||
"WSLINK": "Enable WSLink API if the station is set to send data via WSLink."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"options": {
|
||||
"error": {
|
||||
"valid_credentials_api": "Provide valid API ID.",
|
||||
|
|
@ -27,35 +33,47 @@
|
|||
"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": {
|
||||
"basic": {
|
||||
"data": {
|
||||
"API_ID": "API ID / Station ID",
|
||||
"API_KEY": "API KEY / Password",
|
||||
"dev_debug_checkbox": "Developer log"
|
||||
},
|
||||
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
||||
"title": "Configure credentials",
|
||||
"data_description": {
|
||||
"dev_debug_checkbox": " Enable only if you want to send debuging data to the developer."
|
||||
}
|
||||
},
|
||||
|
||||
"init": {
|
||||
"title": "Configure SWS12500 Integration",
|
||||
"description": "Choose what do you want to configure. If basic access or resending data for Windy site",
|
||||
"menu_options": {
|
||||
"basic": "Basic - configure credentials for Weather Station",
|
||||
"windy": "Windy configuration"
|
||||
},
|
||||
"title": "Configure SWS12500 Integration"
|
||||
}
|
||||
},
|
||||
|
||||
"basic": {
|
||||
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
||||
"title": "Configure credentials",
|
||||
"data": {
|
||||
"API_ID": "API ID / Station ID",
|
||||
"API_KEY": "API KEY / Password",
|
||||
"WSLINK": "WSLink API",
|
||||
"dev_debug_checkbox": "Developer log"
|
||||
},
|
||||
"data_description": {
|
||||
"dev_debug_checkbox": " Enable only if you want to send debuging data to the developer.",
|
||||
"API_ID": "API ID is the Station ID you set in the Weather Station.",
|
||||
"API_KEY": "API KEY is the password you set in the Weather Station.",
|
||||
"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",
|
||||
"data": {
|
||||
"WINDY_API_KEY": "API KEY provided by Windy",
|
||||
"windy_enabled_checkbox": "Enable resending data to Windy",
|
||||
"windy_logger_checkbox": "Log Windy data and responses"
|
||||
},
|
||||
"description": "Resend weather data to your Windy stations.",
|
||||
"title": "Configure Windy"
|
||||
"data_description": {
|
||||
"WINDY_API_KEY": "Windy API KEY obtained from https://https://api.windy.com/keys",
|
||||
"windy_logger_checkbox": "Enable only if you want to send debuging data to the developer."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -77,6 +95,12 @@
|
|||
"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": {
|
||||
|
|
|
|||
|
|
@ -7,20 +7,24 @@
|
|||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"description": "Zadejte API ID a API KEY, aby meteostanice mohla komunikovat s HomeAssistantem",
|
||||
"title": "Nastavení přihlášení",
|
||||
"data": {
|
||||
"API_ID": "API ID / ID stanice",
|
||||
"API_ID": "API ID / ID Stanice",
|
||||
"API_KEY": "API KEY / Heslo",
|
||||
"wslink": "WSLink API",
|
||||
"dev_debug_checkbox": "Developer log"
|
||||
},
|
||||
"description": "Zadejte API ID a API KEY, aby meteostanice mohla komunikovat s HomeAssistantem",
|
||||
"title": "Nastavení přístpu pro metostanici",
|
||||
"data_description": {
|
||||
"dev_debug_checkbox": " Zapnout pouze v případě, že chcete poslat ladící informace vývojáři."
|
||||
"dev_debug_checkbox": "Zapnout pouze v případě, že chcete poslat ladící informace vývojáři.",
|
||||
"API_ID": "API ID je ID stanice, které jste nastavili v meteostanici.",
|
||||
"API_KEY": "API KEY je heslo, které jste nastavili v meteostanici.",
|
||||
"wslink": "WSLink API zapněte, pokud je stanice nastavena na zasílání dat přes WSLink."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"options": {
|
||||
"error": {
|
||||
"valid_credentials_api": "Vyplňte platné API ID",
|
||||
|
|
@ -28,39 +32,50 @@
|
|||
"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"
|
||||
},
|
||||
|
||||
"step": {
|
||||
"init": {
|
||||
"title": "Nastavení integrace SWS12500",
|
||||
"description": "Vyberte, co chcete konfigurovat. Zda přihlašovací údaje nebo nastavení pro přeposílání dat na Windy.",
|
||||
"menu_options": {
|
||||
"basic": "Základní - přístupové údaje (přihlášení)",
|
||||
"windy": "Nastavení pro přeposílání dat na Windy"
|
||||
}
|
||||
},
|
||||
|
||||
"basic": {
|
||||
"description": "Zadejte API ID a API KEY, aby meteostanice mohla komunikovat s HomeAssistantem",
|
||||
"title": "Nastavení přihlášení",
|
||||
"data": {
|
||||
"API_ID": "API ID / ID Stanice",
|
||||
"API_KEY": "API KEY / Heslo",
|
||||
"wslink": "WSLink API",
|
||||
"dev_debug_checkbox": "Developer log"
|
||||
},
|
||||
"description": "Zadejte API ID a API KEY, aby meteostanice mohla komunikovat s HomeAssistantem",
|
||||
"title": "Nastavení přihlášení",
|
||||
"data_description": {
|
||||
"dev_debug_checkbox": " Zapnout pouze v případě, že chcete poslat ladící informace vývojáři."
|
||||
"dev_debug_checkbox": "Zapnout pouze v případě, že chcete poslat ladící informace vývojáři.",
|
||||
"API_ID": "API ID je ID stanice, které jste nastavili v meteostanici.",
|
||||
"API_KEY": "API KEY je heslo, které jste nastavili v meteostanici.",
|
||||
"wslink": "WSLink API zapněte, pokud je stanice nastavena na zasílání dat přes WSLink."
|
||||
}
|
||||
},
|
||||
"init": {
|
||||
"description": "Vyberte, co chcete konfigurovat. Zda přihlašovací údaje nebo nastavení pro přeposílání dat na Windy.",
|
||||
"menu_options": {
|
||||
"basic": "Základní - přístupové údaje (přihlášení)",
|
||||
"windy": "Nastavení pro přeposílání dat na Windy"
|
||||
},
|
||||
"title": "Nastavení integrace SWS12500"
|
||||
},
|
||||
|
||||
"windy": {
|
||||
"description": "Přeposílání dat z metostanice na Windy",
|
||||
"title": "Konfigurace Windy",
|
||||
"data": {
|
||||
"WINDY_API_KEY": "Klíč API KEY získaný z Windy",
|
||||
"windy_enabled_checkbox": "Povolit přeposílání dat na Windy",
|
||||
"windy_logger_checkbox": "Logovat data a odpovědi z Windy"
|
||||
},
|
||||
"description": "Přeposílání dat z metostanice na Windy",
|
||||
"title": "Konfigurace Windy"
|
||||
"data_description": {
|
||||
"WINDY_API_KEY": "Klíč API KEY získaný z https://https://api.windy.com/keys",
|
||||
"windy_logger_checkbox": "Zapnout pouze v případě, že chcete poslat ladící informace vývojáři."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"indoor_temp": { "name": "Vnitřní teplota" },
|
||||
|
|
|
|||
|
|
@ -5,22 +5,27 @@
|
|||
"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",
|
||||
"title": "Configure access for Weather Station",
|
||||
"data": {
|
||||
"API_ID": "API ID / Station ID",
|
||||
"API_KEY": "API KEY / Password",
|
||||
"WSLINK": "WSLink API",
|
||||
"dev_debug_checkbox": "Developer log"
|
||||
},
|
||||
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
||||
"title": "Configure access for Weather Station",
|
||||
"data_description": {
|
||||
"dev_debug_checkbox": " Enable only if you want to send debuging data to the developer."
|
||||
"dev_debug_checkbox": " Enable only if you want to send debuging data to the developer.",
|
||||
"API_ID": "API ID is the Station ID you set in the Weather Station.",
|
||||
"API_KEY": "API KEY is the password you set in the Weather Station.",
|
||||
"WSLINK": "Enable WSLink API if the station is set to send data via WSLink."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"options": {
|
||||
"error": {
|
||||
"valid_credentials_api": "Provide valid API ID.",
|
||||
|
|
@ -28,36 +33,47 @@
|
|||
"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",
|
||||
"description": "Choose what do you want to configure. If basic access or resending data for Windy site",
|
||||
"menu_options": {
|
||||
"basic": "Basic - configure credentials for Weather Station",
|
||||
"windy": "Windy configuration"
|
||||
}
|
||||
},
|
||||
|
||||
"basic": {
|
||||
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
||||
"title": "Configure credentials",
|
||||
"data": {
|
||||
"API_ID": "API ID / Station ID",
|
||||
"API_KEY": "API KEY / Password",
|
||||
"WSLINK": "WSLink API",
|
||||
"dev_debug_checkbox": "Developer log"
|
||||
},
|
||||
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
||||
"title": "Configure credentials",
|
||||
"data_description": {
|
||||
"dev_debug_checkbox": " Enable only if you want to send debuging data to the developer."
|
||||
"dev_debug_checkbox": " Enable only if you want to send debuging data to the developer.",
|
||||
"API_ID": "API ID is the Station ID you set in the Weather Station.",
|
||||
"API_KEY": "API KEY is the password you set in the Weather Station.",
|
||||
"WSLINK": "Enable WSLink API if the station is set to send data via WSLink."
|
||||
}
|
||||
},
|
||||
"init": {
|
||||
"description": "Choose what do you want to configure. If basic access or resending data for Windy site",
|
||||
"menu_options": {
|
||||
"basic": "Basic - configure credentials for Weather Station",
|
||||
"windy": "Windy configuration"
|
||||
},
|
||||
"title": "Configure SWS12500 Integration"
|
||||
},
|
||||
|
||||
"windy": {
|
||||
"description": "Resend weather data to your Windy stations.",
|
||||
"title": "Configure Windy",
|
||||
"data": {
|
||||
"WINDY_API_KEY": "API KEY provided by Windy",
|
||||
"windy_enabled_checkbox": "Enable resending data to Windy",
|
||||
"windy_logger_checkbox": "Log Windy data and responses"
|
||||
},
|
||||
"description": "Resend weather data to your Windy stations.",
|
||||
"title": "Configure Windy"
|
||||
"data_description": {
|
||||
"WINDY_API_KEY": "Windy API KEY obtained from https://https://api.windy.com/keys",
|
||||
"windy_logger_checkbox": "Enable only if you want to send debuging data to the developer."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue