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
This commit is contained in:
Teemu R 2019-02-23 22:57:54 +01:00 committed by Fabian Affolter
parent 1eba90d2a1
commit 492c3b24de

View File

@ -222,11 +222,11 @@ class TPLinkSmartBulb(Light):
if self.smartbulb.is_dimmable: if self.smartbulb.is_dimmable:
self._supported_features += SUPPORT_BRIGHTNESS 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._supported_features += SUPPORT_COLOR_TEMP
self._min_mireds = kelvin_to_mired( self._min_mireds = kelvin_to_mired(
self.smartbulb.valid_temperature_range[1]) self.smartbulb.valid_temperature_range[1])
self._max_mireds = kelvin_to_mired( self._max_mireds = kelvin_to_mired(
self.smartbulb.valid_temperature_range[0]) self.smartbulb.valid_temperature_range[0])
if self.smartbulb.is_color: if getattr(self.smartbulb, 'is_color', False):
self._supported_features += SUPPORT_COLOR self._supported_features += SUPPORT_COLOR