Fix FLUX_LED error when no color is set (#13527)

* Handle turn_on situation when no color is set

As is, an error gets thrown when turn_on is called without an HS value. By adding an if statement, we only try to set RGB if an HS value is applied.

* Fix Whitespace Issues

* Made Requested Changes
pull/13554/head
dramamoose 2018-03-30 15:10:25 -06:00 committed by Paulus Schoutsen
parent 9fc8a8f679
commit 0f2cfe7f27
1 changed files with 6 additions and 1 deletions

View File

@ -204,7 +204,12 @@ class FluxLight(Light):
self._bulb.turnOn()
hs_color = kwargs.get(ATTR_HS_COLOR)
rgb = color_util.color_hs_to_RGB(*hs_color)
if hs_color:
rgb = color_util.color_hs_to_RGB(*hs_color)
else:
rgb = None
brightness = kwargs.get(ATTR_BRIGHTNESS)
effect = kwargs.get(ATTR_EFFECT)