Skip to content

Commit

Permalink
Check for attribute existence for HS220 support (home-assistant#21309)
Browse files Browse the repository at this point in the history
* Check for attribute existence as smartplug does not have them (for HS220 support)

* use getattr over hasattr and a separate check
  • Loading branch information
rytilahti authored and fabaff committed Feb 23, 2019
1 parent 1eba90d commit 492c3b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/tplink/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ def get_features(self):

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

0 comments on commit 492c3b2

Please sign in to comment.