diff --git a/homeassistant/components/binary_sensor/wink.py b/homeassistant/components/binary_sensor/wink.py index 9ba717782e9..4ebe7971660 100644 --- a/homeassistant/components/binary_sensor/wink.py +++ b/homeassistant/components/binary_sensor/wink.py @@ -13,7 +13,7 @@ from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.helpers.entity import Entity from homeassistant.loader import get_component -REQUIREMENTS = ['python-wink==0.7.13', 'pubnub==3.8.2'] +REQUIREMENTS = ['python-wink==0.7.14', 'pubnub==3.8.2'] # These are the available sensors mapped to binary_sensor class SENSOR_TYPES = { diff --git a/homeassistant/components/cover/wink.py b/homeassistant/components/cover/wink.py index 9b76e234303..a8b90809255 100644 --- a/homeassistant/components/cover/wink.py +++ b/homeassistant/components/cover/wink.py @@ -10,7 +10,7 @@ from homeassistant.components.cover import CoverDevice from homeassistant.components.wink import WinkDevice from homeassistant.const import CONF_ACCESS_TOKEN -REQUIREMENTS = ['python-wink==0.7.13', 'pubnub==3.8.2'] +REQUIREMENTS = ['python-wink==0.7.14', 'pubnub==3.8.2'] def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/garage_door/wink.py b/homeassistant/components/garage_door/wink.py index c59d48d48bd..1cc63515e2e 100644 --- a/homeassistant/components/garage_door/wink.py +++ b/homeassistant/components/garage_door/wink.py @@ -10,7 +10,7 @@ from homeassistant.components.garage_door import GarageDoorDevice from homeassistant.components.wink import WinkDevice from homeassistant.const import CONF_ACCESS_TOKEN -REQUIREMENTS = ['python-wink==0.7.13', 'pubnub==3.8.2'] +REQUIREMENTS = ['python-wink==0.7.14', 'pubnub==3.8.2'] def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/light/wink.py b/homeassistant/components/light/wink.py index 957c3a4e116..c41d88a9c30 100644 --- a/homeassistant/components/light/wink.py +++ b/homeassistant/components/light/wink.py @@ -5,6 +5,7 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.wink/ """ import logging +import colorsys from homeassistant.components.light import ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, \ ATTR_RGB_COLOR, SUPPORT_BRIGHTNESS, SUPPORT_COLOR_TEMP, \ @@ -15,7 +16,7 @@ from homeassistant.util import color as color_util from homeassistant.util.color import \ color_temperature_mired_to_kelvin as mired_to_kelvin -REQUIREMENTS = ['python-wink==0.7.13', 'pubnub==3.8.2'] +REQUIREMENTS = ['python-wink==0.7.14', 'pubnub==3.8.2'] SUPPORT_WINK = SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_RGB_COLOR @@ -56,6 +57,21 @@ class WinkLight(WinkDevice, Light): """Return the brightness of the light.""" return int(self.wink.brightness() * 255) + @property + def rgb_color(self): + """Current bulb color in RGB.""" + if not self.wink.supports_hue_saturation(): + return None + else: + hue = self.wink.color_hue() + saturation = self.wink.color_saturation() + value = int(self.wink.brightness() * 255) + rgb = colorsys.hsv_to_rgb(hue, saturation, value) + r_value = int(round(rgb[0])) + g_value = int(round(rgb[1])) + b_value = int(round(rgb[2])) + return r_value, g_value, b_value + @property def xy_color(self): """Current bulb color in CIE 1931 (XY) color space.""" @@ -87,9 +103,14 @@ class WinkLight(WinkDevice, Light): } if rgb_color: - xyb = color_util.color_RGB_to_xy(*rgb_color) - state_kwargs['color_xy'] = xyb[0], xyb[1] - state_kwargs['brightness'] = xyb[2] + if self.wink.supports_xy_color(): + xyb = color_util.color_RGB_to_xy(*rgb_color) + state_kwargs['color_xy'] = xyb[0], xyb[1] + state_kwargs['brightness'] = xyb[2] + elif self.wink.supports_hue_saturation(): + hsv = colorsys.rgb_to_hsv(rgb_color[0], + rgb_color[1], rgb_color[2]) + state_kwargs['color_hue_saturation'] = hsv[0], hsv[1] if color_temp_mired: state_kwargs['color_kelvin'] = mired_to_kelvin(color_temp_mired) diff --git a/homeassistant/components/lock/wink.py b/homeassistant/components/lock/wink.py index 1a09414f8c3..15526ebad8c 100644 --- a/homeassistant/components/lock/wink.py +++ b/homeassistant/components/lock/wink.py @@ -10,7 +10,7 @@ from homeassistant.components.lock import LockDevice from homeassistant.components.wink import WinkDevice from homeassistant.const import CONF_ACCESS_TOKEN -REQUIREMENTS = ['python-wink==0.7.13', 'pubnub==3.8.2'] +REQUIREMENTS = ['python-wink==0.7.14', 'pubnub==3.8.2'] def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/rollershutter/wink.py b/homeassistant/components/rollershutter/wink.py index 18ed193060b..3772c2495fd 100644 --- a/homeassistant/components/rollershutter/wink.py +++ b/homeassistant/components/rollershutter/wink.py @@ -10,7 +10,7 @@ from homeassistant.components.rollershutter import RollershutterDevice from homeassistant.components.wink import WinkDevice from homeassistant.const import CONF_ACCESS_TOKEN -REQUIREMENTS = ['python-wink==0.7.13', 'pubnub==3.8.2'] +REQUIREMENTS = ['python-wink==0.7.14', 'pubnub==3.8.2'] def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/sensor/wink.py b/homeassistant/components/sensor/wink.py index ddc160c5064..a8e1253dec1 100644 --- a/homeassistant/components/sensor/wink.py +++ b/homeassistant/components/sensor/wink.py @@ -12,7 +12,7 @@ from homeassistant.helpers.entity import Entity from homeassistant.components.wink import WinkDevice from homeassistant.loader import get_component -REQUIREMENTS = ['python-wink==0.7.13', 'pubnub==3.8.2'] +REQUIREMENTS = ['python-wink==0.7.14', 'pubnub==3.8.2'] SENSOR_TYPES = ['temperature', 'humidity'] diff --git a/homeassistant/components/switch/wink.py b/homeassistant/components/switch/wink.py index 3a0cd1b7736..3d60749823d 100644 --- a/homeassistant/components/switch/wink.py +++ b/homeassistant/components/switch/wink.py @@ -10,7 +10,7 @@ from homeassistant.components.wink import WinkDevice from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.helpers.entity import ToggleEntity -REQUIREMENTS = ['python-wink==0.7.13', 'pubnub==3.8.2'] +REQUIREMENTS = ['python-wink==0.7.14', 'pubnub==3.8.2'] def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/wink.py b/homeassistant/components/wink.py index fe57fa289f2..144e1e0b237 100644 --- a/homeassistant/components/wink.py +++ b/homeassistant/components/wink.py @@ -14,7 +14,7 @@ from homeassistant.const import CONF_ACCESS_TOKEN, ATTR_BATTERY_LEVEL from homeassistant.helpers.entity import Entity import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ['python-wink==0.7.13', 'pubnub==3.8.2'] +REQUIREMENTS = ['python-wink==0.7.14', 'pubnub==3.8.2'] _LOGGER = logging.getLogger(__name__) diff --git a/requirements_all.txt b/requirements_all.txt index c0ef98ffdc1..61d221ba7fb 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -394,7 +394,7 @@ python-twitch==1.3.0 # homeassistant.components.rollershutter.wink # homeassistant.components.sensor.wink # homeassistant.components.switch.wink -python-wink==0.7.13 +python-wink==0.7.14 # homeassistant.components.keyboard pyuserinput==0.1.11