Wink scene(shortcut) support (#6147)
* Wink scene(shortcut) support * Scenes to Scene * Moved wink scenes from switches to scenes * Updated python-wink version
This commit is contained in:
parent
11f11481b2
commit
62e57456e1
4 changed files with 47 additions and 3 deletions
|
@ -18,6 +18,8 @@ DEPENDENCIES = ['wink']
|
|||
|
||||
SUPPORT_WINK = SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_RGB_COLOR
|
||||
|
||||
RGB_MODES = ['hsb', 'rgb']
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Setup the Wink lights."""
|
||||
|
@ -54,6 +56,8 @@ class WinkLight(WinkDevice, Light):
|
|||
"""Current bulb color in RGB."""
|
||||
if not self.wink.supports_hue_saturation():
|
||||
return None
|
||||
elif self.wink.color_model() not in RGB_MODES:
|
||||
return False
|
||||
else:
|
||||
hue = self.wink.color_hue()
|
||||
saturation = self.wink.color_saturation()
|
||||
|
|
40
homeassistant/components/scene/wink.py
Normal file
40
homeassistant/components/scene/wink.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
"""
|
||||
Support for Wink scenes.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/scene.wink/
|
||||
"""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.scene import Scene
|
||||
from homeassistant.components.wink import WinkDevice, DOMAIN
|
||||
|
||||
DEPENDENCIES = ['wink']
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Setup the Wink platform."""
|
||||
import pywink
|
||||
|
||||
for scene in pywink.get_scenes():
|
||||
_id = scene.object_id() + scene.name()
|
||||
if _id not in hass.data[DOMAIN]['unique_ids']:
|
||||
add_devices([WinkScene(scene, hass)])
|
||||
|
||||
|
||||
class WinkScene(WinkDevice, Scene):
|
||||
"""Representation of a Wink shortcut/scene."""
|
||||
|
||||
def __init__(self, wink, hass):
|
||||
"""Initialize the Wink device."""
|
||||
super().__init__(wink, hass)
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Python-wink will always return False."""
|
||||
return self.wink.state()
|
||||
|
||||
def activate(self, **kwargs):
|
||||
"""Activate the scene."""
|
||||
self.wink.activate()
|
|
@ -15,7 +15,7 @@ from homeassistant.const import (
|
|||
from homeassistant.helpers.entity import Entity
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
REQUIREMENTS = ['python-wink==1.1.1', 'pubnubsub-handler==1.0.1']
|
||||
REQUIREMENTS = ['python-wink==1.2.1', 'pubnubsub-handler==1.0.1']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -55,7 +55,7 @@ CONFIG_SCHEMA = vol.Schema({
|
|||
|
||||
WINK_COMPONENTS = [
|
||||
'binary_sensor', 'sensor', 'light', 'switch', 'lock', 'cover', 'climate',
|
||||
'fan', 'alarm_control_panel'
|
||||
'fan', 'alarm_control_panel', 'scene'
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -615,7 +615,7 @@ python-twitch==1.3.0
|
|||
python-vlc==1.1.2
|
||||
|
||||
# homeassistant.components.wink
|
||||
python-wink==1.1.1
|
||||
python-wink==1.2.1
|
||||
|
||||
# homeassistant.components.device_tracker.trackr
|
||||
pytrackr==0.0.5
|
||||
|
|
Loading…
Add table
Reference in a new issue