From d57061f7251b813d39a6740df89a1fe097b7029b Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Wed, 18 Jul 2018 14:08:20 +0200 Subject: [PATCH] tplink.light: initialize supported features in setup_platform Fixes #15339 --- homeassistant/components/light/tplink.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/light/tplink.py b/homeassistant/components/light/tplink.py index 09a4fa3610d8c4..d9e1938ce02c1a 100644 --- a/homeassistant/components/light/tplink.py +++ b/homeassistant/components/light/tplink.py @@ -40,7 +40,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None): from pyHS100 import SmartBulb host = config.get(CONF_HOST) name = config.get(CONF_NAME) - add_devices([TPLinkSmartBulb(SmartBulb(host), name)], True) + bulb = TPLinkSmartBulb(SmartBulb(host), name) + bulb.get_features() + add_devices([bulb], True) def brightness_to_percentage(byt): @@ -140,9 +142,6 @@ def update(self): try: self._available = True - if self._supported_features == 0: - self.get_features() - self._state = ( self.smartbulb.state == self.smartbulb.BULB_STATE_ON)