Update for style changes in python-wink
This commit is contained in:
parent
c91cd9aa84
commit
afbf377b6d
6 changed files with 39 additions and 77 deletions
|
@ -31,6 +31,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
pywink.set_bearer_token(token)
|
||||
|
||||
add_devices(WinkSensorDevice(sensor) for sensor in pywink.get_sensors())
|
||||
add_devices(WinkEggMinder(eggtray) for eggtray in pywink.get_eggtrays())
|
||||
|
||||
|
||||
class WinkSensorDevice(Entity):
|
||||
|
@ -47,7 +48,7 @@ class WinkSensorDevice(Entity):
|
|||
@property
|
||||
def unique_id(self):
|
||||
""" Returns the id of this wink sensor """
|
||||
return "{}.{}".format(self.__class__, self.wink.deviceId())
|
||||
return "{}.{}".format(self.__class__, self.wink.device_id())
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -56,9 +57,34 @@ class WinkSensorDevice(Entity):
|
|||
|
||||
def update(self):
|
||||
""" Update state of the sensor. """
|
||||
self.wink.updateState()
|
||||
self.wink.update_state()
|
||||
|
||||
@property
|
||||
def is_open(self):
|
||||
""" True if door is open. """
|
||||
return self.wink.state()
|
||||
|
||||
class WinkEggMinder(Entity):
|
||||
""" Represents a Wink Egg Minder. """
|
||||
|
||||
def __init__(self, wink):
|
||||
self.wink = wink
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
""" Returns the state. """
|
||||
return self.wink.state()
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
""" Returns the id of this wink Egg Minder """
|
||||
return "{}.{}".format(self.__class__, self.wink.device_id())
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
""" Returns the name of the Egg Minder if any. """
|
||||
return self.wink.name()
|
||||
|
||||
def update(self):
|
||||
""" Update state of the Egg Minder. """
|
||||
self.wink.update_state()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue