mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
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:
parent
1eba90d2a1
commit
492c3b24de
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user