Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions homeassistant/components/meteo_france/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -179,4 +185,6 @@ def update(self):
try:
self._client.update()
except meteofranceError as exp:
_LOGGER.error(exp)
_LOGGER.error(
"Unexpected error when updating the meteofrance proxy: %s", exp
)
12 changes: 8 additions & 4 deletions homeassistant/components/meteo_france/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down