When tradfri experience communication errors make the lights/devices unavailable. (#19288)
This commit is contained in:
parent
e2f55a959f
commit
b3a08d5876
2 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue