mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Allow tradfri to read the available state of the device (#11056)
* Allow tradfri to read the available state of the device * Update tradfri.py
This commit is contained in:
parent
a4214afddb
commit
7259cc878e
@ -160,6 +160,7 @@ class TradfriLight(Light):
|
|||||||
self._rgb_color = None
|
self._rgb_color = None
|
||||||
self._features = SUPPORTED_FEATURES
|
self._features = SUPPORTED_FEATURES
|
||||||
self._temp_supported = False
|
self._temp_supported = False
|
||||||
|
self._available = True
|
||||||
|
|
||||||
self._refresh(light)
|
self._refresh(light)
|
||||||
|
|
||||||
@ -196,6 +197,11 @@ class TradfriLight(Light):
|
|||||||
"""Start thread when added to hass."""
|
"""Start thread when added to hass."""
|
||||||
self._async_start_observe()
|
self._async_start_observe()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def available(self):
|
||||||
|
"""Return True if entity is available."""
|
||||||
|
return self._available
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""No polling needed for tradfri light."""
|
"""No polling needed for tradfri light."""
|
||||||
@ -299,6 +305,7 @@ class TradfriLight(Light):
|
|||||||
self._light = light
|
self._light = light
|
||||||
|
|
||||||
# Caching of LightControl and light object
|
# Caching of LightControl and light object
|
||||||
|
self._available = light.reachable
|
||||||
self._light_control = light.light_control
|
self._light_control = light.light_control
|
||||||
self._light_data = light.light_control.lights[0]
|
self._light_data = light.light_control.lights[0]
|
||||||
self._name = light.name
|
self._name = light.name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user