From 2189516966e1b94bc854406a41aeeb2721a2136b Mon Sep 17 00:00:00 2001 From: Keaton Taylor Date: Mon, 11 Jul 2016 14:39:46 -0500 Subject: [PATCH] Clamp brightness between 0 and 255 (#2494) * Clamp brightness between 0 and 255 Change to ensure that values over 255 supplied by the config will be clamed to a max value of 255. * Revert "Clamp brightness between 0 and 255" This reverts commit c87238e8b5d3a67c035b1a97d5b5b9af8f6483bc. * Clamp brightness between 0 and 255 Change to ensure that values over 255 supplied by the config will be clamed to a max value of 255. --- homeassistant/components/light/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 2b0af395d02..2a87d2e88bb 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -67,12 +67,13 @@ PROP_TO_ATTR = { # Service call validation schemas VALID_TRANSITION = vol.All(vol.Coerce(int), vol.Clamp(min=0, max=900)) +VALID_BRIGHTNESS = vol.All(vol.Coerce(int), vol.Clamp(min=0, max=255)) LIGHT_TURN_ON_SCHEMA = vol.Schema({ ATTR_ENTITY_ID: cv.entity_ids, ATTR_PROFILE: str, ATTR_TRANSITION: VALID_TRANSITION, - ATTR_BRIGHTNESS: cv.byte, + ATTR_BRIGHTNESS: VALID_BRIGHTNESS, ATTR_COLOR_NAME: str, ATTR_RGB_COLOR: vol.All(vol.ExactSequence((cv.byte, cv.byte, cv.byte)), vol.Coerce(tuple)),