Vera colored light support (#7942)

* Added support for color to vera lights

* Updated requirements
pull/6882/merge
Alan Fischer 2017-06-08 04:28:03 -06:00 committed by Pascal Vizeli
parent 620197b276
commit 1e352d37d0
3 changed files with 14 additions and 5 deletions

View File

@ -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()

View File

@ -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__)

View File

@ -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