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

@ -7,7 +7,8 @@ https://home-assistant.io/components/light.wink/
import logging
from homeassistant.components.light import ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, \
Light, ATTR_RGB_COLOR
ATTR_RGB_COLOR, SUPPORT_BRIGHTNESS, SUPPORT_COLOR_TEMP, \
SUPPORT_RGB_COLOR, Light
from homeassistant.components.wink import WinkDevice
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.util import color as color_util
@ -16,6 +17,8 @@ from homeassistant.util.color import \
REQUIREMENTS = ['python-wink==0.7.11', 'pubnub==3.8.2']
SUPPORT_WINK = SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_RGB_COLOR
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
"""Setup Wink lights."""
@ -68,6 +71,11 @@ class WinkLight(WinkDevice, Light):
return color_util.color_temperature_kelvin_to_mired(
self.wink.color_temperature_kelvin())
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_WINK
# pylint: disable=too-few-public-methods
def turn_on(self, **kwargs):
"""Turn the switch on."""