From cf664e42cca80546f1f85963f58c96942ac62138 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 29 Apr 2017 21:39:27 -0700 Subject: [PATCH] Add assumed state to sensehat light. --- homeassistant/components/light/sensehat.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/homeassistant/components/light/sensehat.py b/homeassistant/components/light/sensehat.py index acda0dc206c..5e623fc772e 100644 --- a/homeassistant/components/light/sensehat.py +++ b/homeassistant/components/light/sensehat.py @@ -82,6 +82,16 @@ class SenseHatLight(Light): """Return true if light is on.""" return self._is_on + @property + def should_poll(self): + """Return if we should poll this device.""" + return False + + @property + def assumed_state(self) -> bool: + """Return True if unable to access real state of the entity.""" + return True + def turn_on(self, **kwargs): """Instruct the light to turn on and set correct brightness & color.""" self._brightness = kwargs.get(ATTR_BRIGHTNESS, 255) @@ -95,8 +105,10 @@ class SenseHatLight(Light): int(self._rgb_color[2] * percent_bright)) self._is_on = True + this.schedule_update_ha_state() def turn_off(self, **kwargs): """Instruct the light to turn off.""" self._sensehat.clear() self._is_on = False + this.schedule_update_ha_state()