From 492c3b24de9668be36d6ef27627dd5e02aadbde5 Mon Sep 17 00:00:00 2001 From: Teemu R Date: Sat, 23 Feb 2019 22:57:54 +0100 Subject: [PATCH] Check for attribute existence for HS220 support (#21309) * Check for attribute existence as smartplug does not have them (for HS220 support) * use getattr over hasattr and a separate check --- homeassistant/components/tplink/light.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/tplink/light.py b/homeassistant/components/tplink/light.py index 5d22b1ae60f..1e31df98af5 100644 --- a/homeassistant/components/tplink/light.py +++ b/homeassistant/components/tplink/light.py @@ -222,11 +222,11 @@ class TPLinkSmartBulb(Light): if self.smartbulb.is_dimmable: self._supported_features += SUPPORT_BRIGHTNESS - if self.smartbulb.is_variable_color_temp: + if getattr(self.smartbulb, 'is_variable_color_temp', False): self._supported_features += SUPPORT_COLOR_TEMP self._min_mireds = kelvin_to_mired( self.smartbulb.valid_temperature_range[1]) self._max_mireds = kelvin_to_mired( self.smartbulb.valid_temperature_range[0]) - if self.smartbulb.is_color: + if getattr(self.smartbulb, 'is_color', False): self._supported_features += SUPPORT_COLOR