Skip to content

Commit

Permalink
Check for attribute existence as smartplug does not have them (for HS…
Browse files Browse the repository at this point in the history
…220 support)
  • Loading branch information
rytilahti committed Feb 22, 2019
1 parent 3fcbc36 commit e535fb4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions homeassistant/components/tplink/light.py
Expand Up @@ -222,11 +222,12 @@ def get_features(self):

if self.smartbulb.is_dimmable:
self._supported_features += SUPPORT_BRIGHTNESS
if self.smartbulb.is_variable_color_temp:
if hasattr(self.smartbulb, 'is_variable_color_temp') \
and self.smartbulb.is_variable_color_temp:
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 hasattr(self.smartbulb, 'is_color') and self.smartbulb.is_color:
self._supported_features += SUPPORT_COLOR

0 comments on commit e535fb4

Please sign in to comment.