Updating to python-wink 0.3.0

This commit is contained in:
bradsk88 2015-12-15 21:43:12 -06:00
parent 13b0d2afa3
commit 58988787ea
7 changed files with 35 additions and 35 deletions

View File

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

View File

@ -11,9 +11,9 @@ import logging
from homeassistant.components.lock import LockDevice from homeassistant.components.lock import LockDevice
from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.const import CONF_ACCESS_TOKEN
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/' REQUIREMENTS = ['https://github.com/bradsk88/python-wink/archive/'
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip' '91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.2'] '#python-wink==0.3']
def setup_platform(hass, config, add_devices, discovery_info=None): 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): class WinkLockDevice(LockDevice):
""" Represents a Wink lock. """ """ Represents a Wink lock. """
def __init__(self, wink): import pywink
def __init__(self, wink: pywink.WinkLock):
self.wink = wink self.wink = wink
@property @property
def unique_id(self): def unique_id(self):
""" Returns the id of this wink lock """ """ Returns the id of this wink lock """
return "{}.{}".format(self.__class__, self.wink.deviceId()) return "{}.{}".format(self.__class__, self.wink.device_id())
@property @property
def name(self): def name(self):
@ -52,7 +54,7 @@ class WinkLockDevice(LockDevice):
def update(self): def update(self):
""" Update the state of the lock. """ """ Update the state of the lock. """
self.wink.updateState() self.wink.update_state()
@property @property
def is_locked(self): def is_locked(self):
@ -61,8 +63,8 @@ class WinkLockDevice(LockDevice):
def lock(self): def lock(self):
""" Lock the device. """ """ Lock the device. """
self.wink.setState(True) self.wink.set_state(True)
def unlock(self): def unlock(self):
""" Unlock the device. """ """ 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.helpers.entity import Entity
from homeassistant.const import CONF_ACCESS_TOKEN, STATE_OPEN, STATE_CLOSED from homeassistant.const import CONF_ACCESS_TOKEN, STATE_OPEN, STATE_CLOSED
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/' REQUIREMENTS = ['https://github.com/bradsk88/python-wink/archive/'
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip' '91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.2'] '#python-wink==0.3']
def setup_platform(hass, config, add_devices, discovery_info=None): 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.components.wink import WinkToggleDevice
from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.const import CONF_ACCESS_TOKEN
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/' REQUIREMENTS = ['https://github.com/bradsk88/python-wink/archive/'
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip' '91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.2'] '#python-wink==0.3']
def setup_platform(hass, config, add_devices, discovery_info=None): 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) ATTR_SERVICE, ATTR_DISCOVERED, ATTR_FRIENDLY_NAME)
DOMAIN = "wink" DOMAIN = "wink"
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/' REQUIREMENTS = ['https://github.com/bradsk88/python-wink/archive/'
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip' '91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.2'] '#python-wink==0.3']
DISCOVER_LIGHTS = "wink.lights" DISCOVER_LIGHTS = "wink.lights"
DISCOVER_SWITCHES = "wink.switches" DISCOVER_SWITCHES = "wink.switches"
@ -61,14 +61,15 @@ def setup(hass, config):
class WinkToggleDevice(ToggleEntity): class WinkToggleDevice(ToggleEntity):
""" Represents a Wink toogle (switch) device. """ """ Represents a Wink toogle (switch) device. """
import pywink
def __init__(self, wink): def __init__(self, wink: pywink.WinkBinarySwitch):
self.wink = wink self.wink = wink
@property @property
def unique_id(self): def unique_id(self):
""" Returns the id of this Wink switch. """ """ Returns the id of this Wink switch. """
return "{}.{}".format(self.__class__, self.wink.deviceId()) return "{}.{}".format(self.__class__, self.wink.device_id())
@property @property
def name(self): def name(self):
@ -89,12 +90,12 @@ class WinkToggleDevice(ToggleEntity):
def turn_on(self, **kwargs): def turn_on(self, **kwargs):
""" Turns the switch on. """ """ Turns the switch on. """
self.wink.setState(True) self.wink.set_state(True)
def turn_off(self): def turn_off(self):
""" Turns the switch off. """ """ Turns the switch off. """
self.wink.setState(False) self.wink.set_state(False)
def update(self): def update(self):
""" Update state of the light. """ """ 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 pyyaml>=3.11,<4
pytz>=2015.4 pytz>=2015.4
pip>=7.0.0 pip>=7.0.0
vincenty==0.1.3 vincenty==0.1.3

View File

@ -60,7 +60,7 @@ https://github.com/pavoni/home-assistant-vera-api/archive/efdba4e63d58a30bc9b36d
# homeassistant.components.lock.wink # homeassistant.components.lock.wink
# homeassistant.components.sensor.wink # homeassistant.components.sensor.wink
# homeassistant.components.switch.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 # homeassistant.components.media_player.cast
pychromecast==0.6.12 pychromecast==0.6.12
@ -83,9 +83,6 @@ https://github.com/bashwork/pymodbus/archive/d7fc4f1cc975631e0a9011390e8017f64b6
# homeassistant.components.mqtt # homeassistant.components.mqtt
paho-mqtt==1.1 paho-mqtt==1.1
# homeassistant.components.mqtt
jsonpath-rw==1.4.0
# homeassistant.components.notify.pushbullet # homeassistant.components.notify.pushbullet
pushbullet.py==0.9.0 pushbullet.py==0.9.0
@ -160,6 +157,9 @@ orvibo==1.0.1
# homeassistant.components.switch.wemo # homeassistant.components.switch.wemo
pywemo==0.3.3 pywemo==0.3.3
# homeassistant.components.thermostat.heatmiser
heatmiserV3==0.9.1
# homeassistant.components.thermostat.honeywell # homeassistant.components.thermostat.honeywell
evohomeclient==0.2.4 evohomeclient==0.2.4
@ -174,6 +174,3 @@ https://github.com/persandstrom/python-verisure/archive/9873c4527f01b1ba1f72ae60
# homeassistant.components.zwave # homeassistant.components.zwave
pydispatcher==2.0.5 pydispatcher==2.0.5
# homeassistant.components.heatmiser
heatmiserV3==0.9.1