mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 04:35:11 +02:00
When tradfri experience communication errors make the lights/devices unavailable. (#19288)
This commit is contained in:
committed by
Paulus Schoutsen
parent
e2f55a959f
commit
b3a08d5876
@@ -339,6 +339,8 @@ class TradfriLight(Light):
|
||||
# pylint: disable=import-error
|
||||
from pytradfri.error import PytradfriError
|
||||
if exc:
|
||||
self._available = False
|
||||
self.async_schedule_update_ha_state()
|
||||
_LOGGER.warning("Observation failed for %s", self._name,
|
||||
exc_info=exc)
|
||||
|
||||
|
@@ -108,6 +108,8 @@ class TradfriSwitch(SwitchDevice):
|
||||
"""Start observation of switch."""
|
||||
from pytradfri.error import PytradfriError
|
||||
if exc:
|
||||
self._available = False
|
||||
self.async_schedule_update_ha_state()
|
||||
_LOGGER.warning("Observation failed for %s", self._name,
|
||||
exc_info=exc)
|
||||
|
||||
|
Reference in New Issue
Block a user