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