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

@ -11,7 +11,8 @@ import homeassistant.util as util
import homeassistant.util.color as color_util
from homeassistant.components.light import (
Light, ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_RGB_COLOR, ATTR_TRANSITION,
ATTR_XY_COLOR)
ATTR_XY_COLOR, SUPPORT_BRIGHTNESS, SUPPORT_COLOR_TEMP, SUPPORT_RGB_COLOR,
SUPPORT_TRANSITION, SUPPORT_XY_COLOR)
DEPENDENCIES = ['wemo']
@ -20,6 +21,9 @@ MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(milliseconds=100)
_LOGGER = logging.getLogger(__name__)
SUPPORT_WEMO = (SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_RGB_COLOR |
SUPPORT_TRANSITION | SUPPORT_XY_COLOR)
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
"""Setup WeMo bridges and register connected lights."""
@ -96,6 +100,11 @@ class WemoLight(Light):
"""True if device is on."""
return self.device.state['onoff'] != 0
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_WEMO
def turn_on(self, **kwargs):
"""Turn the light on."""
transitiontime = int(kwargs.get(ATTR_TRANSITION, 0))