Wink Thermostat support and NoneType error fixes (#4175)
This commit is contained in:
1 parent
c980d26aae
commit
bab8d574fe
6 files changed
+377
-33
No files matched your search
@@ -41,7 +41,10 @@ class WinkLight(WinkDevice, Light):
|
||||
@property
|
||||
def brightness(self):
|
||||
"""Return the brightness of the light."""
|
||||
return int(self.wink.brightness() * 255)
|
||||
if self.wink.brightness() is not None:
|
||||
return int(self.wink.brightness() * 255)
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def rgb_color(self):
|
||||
@@ -52,6 +55,8 @@ class WinkLight(WinkDevice, Light):
|
||||
hue = self.wink.color_hue()
|
||||
saturation = self.wink.color_saturation()
|
||||
value = int(self.wink.brightness() * 255)
|
||||
if hue is None or saturation is None or value is None:
|
||||
return None
|
||||
rgb = colorsys.hsv_to_rgb(hue, saturation, value)
|
||||
r_value = int(round(rgb[0]))
|
||||
g_value = int(round(rgb[1]))
|
||||
|
||||
Reference in new issue
Block a user