Compare commits
2 Commits
e25a95277c
...
4aabc1c65d
| Author | SHA1 | Date |
|---|---|---|
|
|
4aabc1c65d | |
|
|
5ca0d65cd6 |
|
|
@ -86,7 +86,7 @@ class WeatherDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
raise HTTPUnauthorized
|
||||
|
||||
if self.config_entry.options.get(WINDY_ENABLED):
|
||||
response = await self.windy.push_data_to_windy(data, _wslink)
|
||||
_ = await self.windy.push_data_to_windy(data, _wslink)
|
||||
|
||||
if self.config.options.get(POCASI_CZ_ENABLED):
|
||||
await self.pocasi.push_data_to_server(data, "WSLINK" if _wslink else "WU")
|
||||
|
|
|
|||
|
|
@ -197,13 +197,19 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
|||
errors=errors,
|
||||
)
|
||||
|
||||
if (user_input[WINDY_ENABLED] is True) and ((user_input[WINDY_STATION_ID] == "") or (user_input[WINDY_STATION_PW] == "")):
|
||||
errors[WINDY_STATION_ID] = "windy_key_required"
|
||||
return self.async_show_form(
|
||||
step_id="windy",
|
||||
data_schema=vol.Schema(self.windy_data_schema),
|
||||
errors=errors,
|
||||
)
|
||||
station_id = (user_input.get(WINDY_STATION_ID) or "").strip()
|
||||
station_pw = (user_input.get(WINDY_STATION_PW) or "").strip()
|
||||
if user_input.get(WINDY_ENABLED):
|
||||
if not station_id:
|
||||
errors[WINDY_STATION_ID] = "windy_id_required"
|
||||
if not station_pw:
|
||||
errors[WINDY_STATION_PW] = "windy_pw_required"
|
||||
if errors:
|
||||
return self.async_show_form(
|
||||
step_id="windy",
|
||||
data_schema=vol.Schema(self.windy_data_schema),
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
# retain user_data
|
||||
user_input.update(self.user_data)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@
|
|||
"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_id_required": "Je vyžadováno Windy ID, pokud chcete aktivovat přeposílání dat na Windy",
|
||||
"windy_pw_required": "Je vyžadován Windy 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_send_minimum": "Minimální interval pro přeposílání je 12 sekund."
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@
|
|||
"valid_credentials_api": "Provide valid API ID.",
|
||||
"valid_credentials_key": "Provide valid API KEY.",
|
||||
"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."
|
||||
"windy_id_required": "Windy API key is required if you want to enable this function.",
|
||||
"windy_pw_required": "Windy API password is required if you want to enable this function."
|
||||
},
|
||||
"step": {
|
||||
"init": {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import logging
|
|||
|
||||
from aiohttp.client_exceptions import ClientError
|
||||
|
||||
from homeassistant.components import persistent_notification
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
|
@ -138,8 +139,22 @@ 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, "")
|
||||
windy_station_pw = self.config.options.get(WINDY_STATION_PW, "")
|
||||
|
||||
if windy_station_id == "" or windy_station_pw == "":
|
||||
_LOGGER.error(
|
||||
"Windy ID or PASSWORD is not set correctly. Please reconfigure your WINDY resend credentials. Disabling WINDY resend for now!"
|
||||
)
|
||||
|
||||
persistent_notification.async_create(
|
||||
self.hass,
|
||||
"Your Windy credentials are not set correctly. Disabling Windy resending for now. Update Windy options and enable reseding.",
|
||||
"Windy resending disabled.",
|
||||
)
|
||||
|
||||
await update_options(self.hass, self.config, WINDY_ENABLED, False)
|
||||
return False
|
||||
|
||||
request_url = f"{WINDY_URL}"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue