Merge pull request #762 from bradsk88/pywink-0.3

Updating to python-wink 0.3.0
This commit is contained in:
Paulus Schoutsen 2015-12-16 07:50:35 -08:00
commit c8234ffb8d
7 changed files with 32 additions and 29 deletions

View file

@ -12,9 +12,9 @@ from homeassistant.components.light import ATTR_BRIGHTNESS
from homeassistant.components.wink import WinkToggleDevice
from homeassistant.const import CONF_ACCESS_TOKEN
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/'
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip'
'#python-wink==0.2']
REQUIREMENTS = ['https://github.com/bradsk88/python-wink/archive/'
'91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.3']
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
@ -45,10 +45,10 @@ class WinkLight(WinkToggleDevice):
brightness = kwargs.get(ATTR_BRIGHTNESS)
if brightness is not None:
self.wink.setState(True, brightness / 255)
self.wink.set_state(True, brightness=brightness / 255)
else:
self.wink.setState(True)
self.wink.set_state(True)
@property
def state_attributes(self):

View file

@ -11,9 +11,9 @@ import logging
from homeassistant.components.lock import LockDevice
from homeassistant.const import CONF_ACCESS_TOKEN
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/'
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip'
'#python-wink==0.2']
REQUIREMENTS = ['https://github.com/bradsk88/python-wink/archive/'
'91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.3']
def setup_platform(hass, config, add_devices, discovery_info=None):
@ -37,13 +37,15 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class WinkLockDevice(LockDevice):
""" Represents a Wink lock. """
def __init__(self, wink):
import pywink
def __init__(self, wink: pywink.WinkLock):
self.wink = wink
@property
def unique_id(self):
""" Returns the id of this wink lock """
return "{}.{}".format(self.__class__, self.wink.deviceId())
return "{}.{}".format(self.__class__, self.wink.device_id())
@property
def name(self):
@ -52,7 +54,7 @@ class WinkLockDevice(LockDevice):
def update(self):
""" Update the state of the lock. """
self.wink.updateState()
self.wink.update_state()
@property
def is_locked(self):
@ -61,8 +63,8 @@ class WinkLockDevice(LockDevice):
def lock(self):
""" Lock the device. """
self.wink.setState(True)
self.wink.set_state(True)
def unlock(self):
""" Unlock the device. """
self.wink.setState(False)
self.wink.set_state(False)

View file

@ -11,9 +11,9 @@ import logging
from homeassistant.helpers.entity import Entity
from homeassistant.const import CONF_ACCESS_TOKEN, STATE_OPEN, STATE_CLOSED
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/'
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip'
'#python-wink==0.2']
REQUIREMENTS = ['https://github.com/bradsk88/python-wink/archive/'
'91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.3']
def setup_platform(hass, config, add_devices, discovery_info=None):

View file

@ -11,9 +11,9 @@ import logging
from homeassistant.components.wink import WinkToggleDevice
from homeassistant.const import CONF_ACCESS_TOKEN
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/'
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip'
'#python-wink==0.2']
REQUIREMENTS = ['https://github.com/bradsk88/python-wink/archive/'
'91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.3']
def setup_platform(hass, config, add_devices, discovery_info=None):

View file

@ -17,9 +17,9 @@ from homeassistant.const import (
ATTR_SERVICE, ATTR_DISCOVERED, ATTR_FRIENDLY_NAME)
DOMAIN = "wink"
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/'
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip'
'#python-wink==0.2']
REQUIREMENTS = ['https://github.com/bradsk88/python-wink/archive/'
'91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.3']
DISCOVER_LIGHTS = "wink.lights"
DISCOVER_SWITCHES = "wink.switches"
@ -61,14 +61,15 @@ def setup(hass, config):
class WinkToggleDevice(ToggleEntity):
""" Represents a Wink toogle (switch) device. """
import pywink
def __init__(self, wink):
def __init__(self, wink: pywink.WinkBinarySwitch):
self.wink = wink
@property
def unique_id(self):
""" Returns the id of this Wink switch. """
return "{}.{}".format(self.__class__, self.wink.deviceId())
return "{}.{}".format(self.__class__, self.wink.device_id())
@property
def name(self):
@ -89,12 +90,12 @@ class WinkToggleDevice(ToggleEntity):
def turn_on(self, **kwargs):
""" Turns the switch on. """
self.wink.setState(True)
self.wink.set_state(True)
def turn_off(self):
""" Turns the switch off. """
self.wink.setState(False)
self.wink.set_state(False)
def update(self):
""" Update state of the light. """
self.wink.updateState()
self.wink.update_state()

View file

@ -2,4 +2,4 @@ requests>=2,<3
pyyaml>=3.11,<4
pytz>=2015.4
pip>=7.0.0
vincenty==0.1.3
vincenty==0.1.3

View file

@ -63,7 +63,7 @@ https://github.com/pavoni/home-assistant-vera-api/archive/efdba4e63d58a30bc9b36d
# homeassistant.components.lock.wink
# homeassistant.components.sensor.wink
# homeassistant.components.switch.wink
https://github.com/balloob/python-wink/archive/42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip#python-wink==0.2
https://github.com/bradsk88/python-wink/archive/91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip#python-wink==0.3
# homeassistant.components.media_player.cast
pychromecast==0.6.12