From 8654993b1835a317480e305e29a31ca2c0f789a9 Mon Sep 17 00:00:00 2001 From: Gergely Imreh Date: Wed, 3 May 2017 01:02:13 +0100 Subject: [PATCH] light.sensehat: brightness control logic update (#7409) 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 --- homeassistant/components/light/sensehat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/light/sensehat.py b/homeassistant/components/light/sensehat.py index 2cf9c4f9b31..6c5467f8c6d 100644 --- a/homeassistant/components/light/sensehat.py +++ b/homeassistant/components/light/sensehat.py @@ -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: