Vera colored light support (#7942)
* Added support for color to vera lights * Updated requirementspull/6882/merge
parent
620197b276
commit
1e352d37d0
|
@ -7,7 +7,8 @@ https://home-assistant.io/components/light.vera/
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
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 (
|
from homeassistant.components.vera import (
|
||||||
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
|
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEPENDENCIES = ['vera']
|
DEPENDENCIES = ['vera']
|
||||||
|
|
||||||
SUPPORT_VERA = SUPPORT_BRIGHTNESS
|
SUPPORT_VERA = SUPPORT_BRIGHTNESS | SUPPORT_RGB_COLOR
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
|
@ -40,6 +41,12 @@ class VeraLight(VeraDevice, Light):
|
||||||
if self.vera_device.is_dimmable:
|
if self.vera_device.is_dimmable:
|
||||||
return self.vera_device.get_brightness()
|
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
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
|
@ -47,7 +54,9 @@ class VeraLight(VeraDevice, Light):
|
||||||
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Turn the light on."""
|
"""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])
|
self.vera_device.set_brightness(kwargs[ATTR_BRIGHTNESS])
|
||||||
else:
|
else:
|
||||||
self.vera_device.switch_on()
|
self.vera_device.switch_on()
|
||||||
|
|
|
@ -20,7 +20,7 @@ from homeassistant.const import (
|
||||||
EVENT_HOMEASSISTANT_STOP)
|
EVENT_HOMEASSISTANT_STOP)
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
REQUIREMENTS = ['pyvera==0.2.31']
|
REQUIREMENTS = ['pyvera==0.2.32']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -732,7 +732,7 @@ pyunifi==2.12
|
||||||
# pyuserinput==0.1.11
|
# pyuserinput==0.1.11
|
||||||
|
|
||||||
# homeassistant.components.vera
|
# homeassistant.components.vera
|
||||||
pyvera==0.2.31
|
pyvera==0.2.32
|
||||||
|
|
||||||
# homeassistant.components.notify.html5
|
# homeassistant.components.notify.html5
|
||||||
pywebpush==1.0.4
|
pywebpush==1.0.4
|
||||||
|
|
Loading…
Reference in New Issue