From 7259cc878e9ab4643c7a6e3d23b0dd478511fac8 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 11 Dec 2017 11:34:48 +0100 Subject: [PATCH] Allow tradfri to read the available state of the device (#11056) * Allow tradfri to read the available state of the device * Update tradfri.py --- homeassistant/components/light/tradfri.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/homeassistant/components/light/tradfri.py b/homeassistant/components/light/tradfri.py index dc8e7f4c996..bb2fa44c15c 100644 --- a/homeassistant/components/light/tradfri.py +++ b/homeassistant/components/light/tradfri.py @@ -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