Changed locked method of lock support to "is_locked".
Added lock and unlock methods Updated wink components to use the new version of the wink library.
This commit is contained in:
parent
fa7391cdf6
commit
105dc2847e
7 changed files with 25 additions and 17 deletions
|
@ -13,8 +13,8 @@ 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/balloob/python-wink/archive/'
|
||||||
'9eb39eaba0717922815e673ad1114c685839d890.zip'
|
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip'
|
||||||
'#python-wink==0.1.1']
|
'#python-wink==0.2']
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||||
|
|
|
@ -44,7 +44,7 @@ PROP_TO_ATTR = {
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def locked(hass, entity_id=None):
|
def is_locked(hass, entity_id=None):
|
||||||
""" Returns if the lock is locked based on the statemachine. """
|
""" Returns if the lock is locked based on the statemachine. """
|
||||||
entity_id = entity_id or ENTITY_ID_ALL_LOCKS
|
entity_id = entity_id or ENTITY_ID_ALL_LOCKS
|
||||||
return hass.states.is_state(entity_id, STATE_LOCKED)
|
return hass.states.is_state(entity_id, STATE_LOCKED)
|
||||||
|
@ -97,13 +97,21 @@ class LockDevice(Entity):
|
||||||
# pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def locked(self):
|
def is_locked(self):
|
||||||
""" Is the lock locked or unlocked. """
|
""" Is the lock locked or unlocked. """
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def lock(self):
|
||||||
|
""" Locks the lock. """
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
def unlock(self):
|
||||||
|
""" Unlocks the lock. """
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
is_locked = self.locked
|
locked = self.is_locked
|
||||||
if is_locked is None:
|
if locked is None:
|
||||||
return STATE_UNKNOWN
|
return STATE_UNKNOWN
|
||||||
return STATE_LOCKED if is_locked else STATE_UNLOCKED
|
return STATE_LOCKED if locked else STATE_UNLOCKED
|
||||||
|
|
|
@ -41,7 +41,7 @@ class DemoLock(LockDevice):
|
||||||
return self._icon
|
return self._icon
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def locked(self):
|
def is_locked(self):
|
||||||
""" True if device is locked. """
|
""" True if device is locked. """
|
||||||
if self._state == STATE_LOCKED:
|
if self._state == STATE_LOCKED:
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -12,8 +12,8 @@ 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/balloob/python-wink/archive/'
|
||||||
'9eb39eaba0717922815e673ad1114c685839d890.zip'
|
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip'
|
||||||
'#python-wink==0.1.1']
|
'#python-wink==0.2']
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
@ -55,7 +55,7 @@ class WinkLockDevice(LockDevice):
|
||||||
self.wink.updateState()
|
self.wink.updateState()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def locked(self):
|
def is_locked(self):
|
||||||
""" True if device is locked. """
|
""" True if device is locked. """
|
||||||
return self.wink.state()
|
return self.wink.state()
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ 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/balloob/python-wink/archive/'
|
||||||
'9eb39eaba0717922815e673ad1114c685839d890.zip'
|
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip'
|
||||||
'#python-wink==0.1.1']
|
'#python-wink==0.2']
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
|
@ -12,8 +12,8 @@ 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/balloob/python-wink/archive/'
|
||||||
'9eb39eaba0717922815e673ad1114c685839d890.zip'
|
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip'
|
||||||
'#python-wink==0.1.1']
|
'#python-wink==0.2']
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
|
@ -19,8 +19,8 @@ from homeassistant.const import (
|
||||||
DOMAIN = "wink"
|
DOMAIN = "wink"
|
||||||
DEPENDENCIES = []
|
DEPENDENCIES = []
|
||||||
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/'
|
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/'
|
||||||
'9eb39eaba0717922815e673ad1114c685839d890.zip'
|
'42fdcfa721b1bc583688e3592d8427f4c13ba6d9.zip'
|
||||||
'#python-wink==0.1.1']
|
'#python-wink==0.2']
|
||||||
|
|
||||||
DISCOVER_LIGHTS = "wink.lights"
|
DISCOVER_LIGHTS = "wink.lights"
|
||||||
DISCOVER_SWITCHES = "wink.switches"
|
DISCOVER_SWITCHES = "wink.switches"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue