From 1e352d37d0588bc65dd3129c99e32c4616790daf Mon Sep 17 00:00:00 2001 From: Alan Fischer Date: Thu, 8 Jun 2017 04:28:03 -0600 Subject: [PATCH] Vera colored light support (#7942) * Added support for color to vera lights * Updated requirements --- homeassistant/components/light/vera.py | 15 ++++++++++++--- homeassistant/components/vera.py | 2 +- requirements_all.txt | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/light/vera.py b/homeassistant/components/light/vera.py index 70432de6644..98e127acc98 100644 --- a/homeassistant/components/light/vera.py +++ b/homeassistant/components/light/vera.py @@ -7,7 +7,8 @@ https://home-assistant.io/components/light.vera/ import logging from homeassistant.components.light import ( - ATTR_BRIGHTNESS, ENTITY_ID_FORMAT, Light, SUPPORT_BRIGHTNESS) + ATTR_BRIGHTNESS, ATTR_RGB_COLOR, ENTITY_ID_FORMAT, + SUPPORT_BRIGHTNESS, SUPPORT_RGB_COLOR, Light) from homeassistant.components.vera import ( VERA_CONTROLLER, VERA_DEVICES, VeraDevice) @@ -15,7 +16,7 @@ _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['vera'] -SUPPORT_VERA = SUPPORT_BRIGHTNESS +SUPPORT_VERA = SUPPORT_BRIGHTNESS | SUPPORT_RGB_COLOR # pylint: disable=unused-argument @@ -40,6 +41,12 @@ class VeraLight(VeraDevice, Light): if self.vera_device.is_dimmable: return self.vera_device.get_brightness() + @property + def rgb_color(self): + """Return the color of the light.""" + if self.vera_device.is_dimmable: + return self.vera_device.get_color() + @property def supported_features(self): """Flag supported features.""" @@ -47,7 +54,9 @@ class VeraLight(VeraDevice, Light): def turn_on(self, **kwargs): """Turn the light on.""" - if ATTR_BRIGHTNESS in kwargs and self.vera_device.is_dimmable: + if ATTR_RGB_COLOR in kwargs and self.vera_device.is_dimmable: + self.vera_device.set_color(kwargs[ATTR_RGB_COLOR]) + elif ATTR_BRIGHTNESS in kwargs and self.vera_device.is_dimmable: self.vera_device.set_brightness(kwargs[ATTR_BRIGHTNESS]) else: self.vera_device.switch_on() diff --git a/homeassistant/components/vera.py b/homeassistant/components/vera.py index 001105374d7..a49c385bdc0 100644 --- a/homeassistant/components/vera.py +++ b/homeassistant/components/vera.py @@ -20,7 +20,7 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_STOP) from homeassistant.helpers.entity import Entity -REQUIREMENTS = ['pyvera==0.2.31'] +REQUIREMENTS = ['pyvera==0.2.32'] _LOGGER = logging.getLogger(__name__) diff --git a/requirements_all.txt b/requirements_all.txt index 215afc1ecb9..34cd42a7cf6 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -732,7 +732,7 @@ pyunifi==2.12 # pyuserinput==0.1.11 # homeassistant.components.vera -pyvera==0.2.31 +pyvera==0.2.32 # homeassistant.components.notify.html5 pywebpush==1.0.4