light.sensehat: brightness control logic update ()

Do not reset brightness when brightness is not explicitly supplied.
Based on conversation at:
https://github.com/home-assistant/home-assistant/pull/7377#discussion_r114102005
This commit is contained in:
Gergely Imreh 2017-05-03 01:02:13 +01:00 committed by Paulus Schoutsen
parent 1aa3ab52b7
commit 8654993b18

View file

@ -91,7 +91,8 @@ class SenseHatLight(Light):
def turn_on(self, **kwargs):
"""Instruct the light to turn on and set correct brightness & color."""
self._brightness = kwargs.get(ATTR_BRIGHTNESS, 255)
if ATTR_BRIGHTNESS in kwargs:
self._brightness = kwargs[ATTR_BRIGHTNESS]
percent_bright = (self._brightness / 255)
if ATTR_RGB_COLOR in kwargs: