mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fail gracefully with unreachable LaMetric (#12451)
Accounts with multiple LaMetric devices at unreachable IPs (for example at a different location, on a different/unroutable subnet, etc.) may cause the notify.lametric service to fail. This update wraps the message sending routine in a try/except clause and outputs log messages indicating the problem. Fixes #12450
This commit is contained in:
parent
8840c227d2
commit
909a06566e
@ -93,6 +93,11 @@ class LaMetricNotificationService(BaseNotificationService):
|
||||
devices = lmn.get_devices()
|
||||
for dev in devices:
|
||||
if targets is None or dev["name"] in targets:
|
||||
try:
|
||||
lmn.set_device(dev)
|
||||
lmn.send_notification(model, lifetime=self._lifetime)
|
||||
_LOGGER.debug("Sent notification to LaMetric %s", dev["name"])
|
||||
_LOGGER.debug("Sent notification to LaMetric %s",
|
||||
dev["name"])
|
||||
except OSError:
|
||||
_LOGGER.warning("Cannot connect to LaMetric %s",
|
||||
dev["name"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user