Added support for exposing light features (#2828)

This commit is contained in:
Assaf Inbal 2016-08-16 09:07:07 +03:00 committed by Paulus Schoutsen
parent d281a7260d
commit 72ad1d8d7c
24 changed files with 250 additions and 26 deletions

View file

@ -8,7 +8,9 @@ import colorsys
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_RGB_COLOR, ATTR_TRANSITION, Light)
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_RGB_COLOR, ATTR_TRANSITION,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR_TEMP, SUPPORT_RGB_COLOR,
SUPPORT_TRANSITION, Light)
from homeassistant.helpers.event import track_time_change
_LOGGER = logging.getLogger(__name__)
@ -24,6 +26,9 @@ TEMP_MAX = 9000 # lifx maximum temperature
TEMP_MIN_HASS = 154 # home assistant minimum temperature
TEMP_MAX_HASS = 500 # home assistant maximum temperature
SUPPORT_LIFX = (SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_RGB_COLOR |
SUPPORT_TRANSITION)
class LIFX():
"""Representation of a LIFX light."""
@ -185,6 +190,11 @@ class LIFXLight(Light):
_LOGGER.debug("is_on: %d", self._power)
return self._power != 0
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_LIFX
def turn_on(self, **kwargs):
"""Turn the device on."""
if ATTR_TRANSITION in kwargs: