Fix typos, fix await in windy_func
parent
0c42c8d827
commit
0679f1e559
|
|
@ -73,16 +73,16 @@
|
||||||
"description": "Resend data to Pocasi Meteo CZ",
|
"description": "Resend data to Pocasi Meteo CZ",
|
||||||
"title": "Configure Pocasi Meteo CZ",
|
"title": "Configure Pocasi Meteo CZ",
|
||||||
"data": {
|
"data": {
|
||||||
"POCASI_API_ID": "ID from your Pocasi Meteo APP",
|
"POCASI_CZ_API_ID": "ID from your Pocasi Meteo APP",
|
||||||
"POCASI_API_KEY": "Key from your Pocasi Meteo APP",
|
"POCASI_CZ_API_KEY": "Key from your Pocasi Meteo APP",
|
||||||
"POCASI_SEND_INTERVAL": "Resend interval in seconds",
|
"POCASI_CZ_SEND_INTERVAL": "Resend interval in seconds",
|
||||||
"pocasi_enabled_checkbox": "Enable resending data to Pocasi Meteo",
|
"pocasi_enabled_checkbox": "Enable resending data to Pocasi Meteo",
|
||||||
"pocasi_logger_checkbox": "Log data and responses"
|
"pocasi_logger_checkbox": "Log data and responses"
|
||||||
},
|
},
|
||||||
"data_description": {
|
"data_description": {
|
||||||
"POCASI_API_ID": "You can obtain your ID in Pocasi Meteo App",
|
"POCASI_CZ_API_ID": "You can obtain your ID in Pocasi Meteo App",
|
||||||
"POCASI_API_KEY": "You can obtain your KEY in Pocasi Meteo App",
|
"POCASI_CZ_API_KEY": "You can obtain your KEY in Pocasi Meteo App",
|
||||||
"POCASI_SEND_INTERVAL": "Resend interval in seconds (minimum 12s, default 30s)",
|
"POCASI_CZ_SEND_INTERVAL": "Resend interval in seconds (minimum 12s, default 30s)",
|
||||||
"pocasi_enabled_checkbox": "Enables resending data to Pocasi Meteo",
|
"pocasi_enabled_checkbox": "Enables resending data to Pocasi Meteo",
|
||||||
"pocasi_logger_checkbox": "Enable only if you want to send debbug data to the developer"
|
"pocasi_logger_checkbox": "Enable only if you want to send debbug data to the developer"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,16 +73,16 @@
|
||||||
"description": "Resend data to Pocasi Meteo CZ",
|
"description": "Resend data to Pocasi Meteo CZ",
|
||||||
"title": "Configure Pocasi Meteo CZ",
|
"title": "Configure Pocasi Meteo CZ",
|
||||||
"data": {
|
"data": {
|
||||||
"POCASI_API_ID": "ID from your Pocasi Meteo APP",
|
"POCASI_CZ_API_ID": "ID from your Pocasi Meteo APP",
|
||||||
"POCASI_API_KEY": "Key from your Pocasi Meteo APP",
|
"POCASI_CZ_API_KEY": "Key from your Pocasi Meteo APP",
|
||||||
"POCASI_SEND_INTERVAL": "Resend interval in seconds",
|
"POCASI_CZ_SEND_INTERVAL": "Resend interval in seconds",
|
||||||
"pocasi_enabled_checkbox": "Enable resending data to Pocasi Meteo",
|
"pocasi_enabled_checkbox": "Enable resending data to Pocasi Meteo",
|
||||||
"pocasi_logger_checkbox": "Log data and responses"
|
"pocasi_logger_checkbox": "Log data and responses"
|
||||||
},
|
},
|
||||||
"data_description": {
|
"data_description": {
|
||||||
"POCASI_API_ID": "You can obtain your ID in Pocasi Meteo App",
|
"POCASI_CZ_API_ID": "You can obtain your ID in Pocasi Meteo App",
|
||||||
"POCASI_API_KEY": "You can obtain your KEY in Pocasi Meteo App",
|
"POCASI_CZ_API_KEY": "You can obtain your KEY in Pocasi Meteo App",
|
||||||
"POCASI_SEND_INTERVAL": "Resend interval in seconds (minimum 12s, default 30s)",
|
"POCASI_CZ_SEND_INTERVAL": "Resend interval in seconds (minimum 12s, default 30s)",
|
||||||
"pocasi_enabled_checkbox": "Enables resending data to Pocasi Meteo",
|
"pocasi_enabled_checkbox": "Enables resending data to Pocasi Meteo",
|
||||||
"pocasi_logger_checkbox": "Enable only if you want to send debbug data to the developer"
|
"pocasi_logger_checkbox": "Enable only if you want to send debbug data to the developer"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from aiohttp.client_exceptions import ClientError
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
|
@ -138,20 +139,20 @@ class WindyPush:
|
||||||
_LOGGER.critical(WINDY_INVALID_KEY)
|
_LOGGER.critical(WINDY_INVALID_KEY)
|
||||||
text_for_test = WINDY_INVALID_KEY
|
text_for_test = WINDY_INVALID_KEY
|
||||||
|
|
||||||
update_options(self.hass, self.config, WINDY_ENABLED, False)
|
await update_options(self.hass, self.config, WINDY_ENABLED, False)
|
||||||
|
|
||||||
except WindySuccess:
|
except WindySuccess:
|
||||||
if self.log:
|
if self.log:
|
||||||
_LOGGER.info(WINDY_SUCCESS)
|
_LOGGER.info(WINDY_SUCCESS)
|
||||||
text_for_test = WINDY_SUCCESS
|
text_for_test = WINDY_SUCCESS
|
||||||
|
|
||||||
except session.ClientError as ex:
|
except ClientError as ex:
|
||||||
_LOGGER.critical("Invalid response from Windy: %s", str(ex))
|
_LOGGER.critical("Invalid response from Windy: %s", str(ex))
|
||||||
self.invalid_response_count += 1
|
self.invalid_response_count += 1
|
||||||
if self.invalid_response_count > 3:
|
if self.invalid_response_count > 3:
|
||||||
_LOGGER.critical(WINDY_UNEXPECTED)
|
_LOGGER.critical(WINDY_UNEXPECTED)
|
||||||
text_for_test = WINDY_UNEXPECTED
|
text_for_test = WINDY_UNEXPECTED
|
||||||
update_options(self.hass, self.config, WINDY_ENABLED, False)
|
await update_options(self.hass, self.config, WINDY_ENABLED, False)
|
||||||
|
|
||||||
self.last_update = datetime.now()
|
self.last_update = datetime.now()
|
||||||
self.next_update = self.last_update + timed(minutes=5)
|
self.next_update = self.last_update + timed(minutes=5)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue