Allow tradfri to read the available state of the device (#11056)

* Allow tradfri to read the available state of the device

* Update tradfri.py
pull/11083/head
Pascal Vizeli 2017-12-11 11:34:48 +01:00 committed by GitHub
parent a4214afddb
commit 7259cc878e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -160,6 +160,7 @@ class TradfriLight(Light):
self._rgb_color = None
self._features = SUPPORTED_FEATURES
self._temp_supported = False
self._available = True
self._refresh(light)
@ -196,6 +197,11 @@ class TradfriLight(Light):
"""Start thread when added to hass."""
self._async_start_observe()
@property
def available(self):
"""Return True if entity is available."""
return self._available
@property
def should_poll(self):
"""No polling needed for tradfri light."""
@ -299,6 +305,7 @@ class TradfriLight(Light):
self._light = light
# Caching of LightControl and light object
self._available = light.reachable
self._light_control = light.light_control
self._light_data = light.light_control.lights[0]
self._name = light.name