mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Meteofrance improve log error messages (#25630)
* Improve log error messages * remove unique_id not ready yet
This commit is contained in:
parent
a177ef02e3
commit
f7a47c6cab
@ -113,13 +113,17 @@ def setup(hass, config):
|
||||
# If weather alert monitoring is expected initiate a client to be used by
|
||||
# all weather_alert entities.
|
||||
if need_weather_alert_watcher:
|
||||
_LOGGER.debug("Weather Alert monitoring expected. Loading vigilancemeteo")
|
||||
from vigilancemeteo import VigilanceMeteoFranceProxy, VigilanceMeteoError
|
||||
|
||||
weather_alert_client = VigilanceMeteoFranceProxy()
|
||||
try:
|
||||
weather_alert_client.update_data()
|
||||
except VigilanceMeteoError as exp:
|
||||
_LOGGER.error(exp)
|
||||
_LOGGER.error(
|
||||
"Unexpected error when creating the" "vigilance_meteoFrance proxy: %s ",
|
||||
exp,
|
||||
)
|
||||
else:
|
||||
weather_alert_client = None
|
||||
hass.data[DATA_METEO_FRANCE]["weather_alert_client"] = weather_alert_client
|
||||
@ -133,7 +137,9 @@ def setup(hass, config):
|
||||
try:
|
||||
client = meteofranceClient(city)
|
||||
except meteofranceError as exp:
|
||||
_LOGGER.error(exp)
|
||||
_LOGGER.error(
|
||||
"Unexpected error when creating the meteofrance proxy: %s", exp
|
||||
)
|
||||
return
|
||||
|
||||
client.need_rain_forecast = bool(
|
||||
@ -179,4 +185,6 @@ class MeteoFranceUpdater:
|
||||
try:
|
||||
self._client.update()
|
||||
except meteofranceError as exp:
|
||||
_LOGGER.error(exp)
|
||||
_LOGGER.error(
|
||||
"Unexpected error when updating the meteofrance proxy: %s", exp
|
||||
)
|
||||
|
@ -35,18 +35,22 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
datas["dept"], weather_alert_client
|
||||
)
|
||||
except ValueError as exp:
|
||||
_LOGGER.error(exp)
|
||||
_LOGGER.error(
|
||||
"Unexpected error when creating the weather alert sensor for %s in department %s: %s",
|
||||
city,
|
||||
datas["dept"],
|
||||
exp,
|
||||
)
|
||||
alert_watcher = None
|
||||
else:
|
||||
_LOGGER.info(
|
||||
"weather alert watcher added for %s" "in department %s",
|
||||
"Weather alert watcher added for %s" "in department %s",
|
||||
city,
|
||||
datas["dept"],
|
||||
)
|
||||
else:
|
||||
_LOGGER.warning(
|
||||
"No dept key found for '%s'. So weather alert "
|
||||
"information won't be available",
|
||||
"No 'dept' key found for '%s'. So weather alert information won't be available",
|
||||
city,
|
||||
)
|
||||
# Exit and don't create the sensor if no department code available.
|
||||
|
Loading…
x
Reference in New Issue
Block a user