Merge pull request #747 from w1ll1am23/dev

Added support for the Quirky Egg Minder
This commit is contained in:
Paulus Schoutsen 2015-12-16 20:08:00 -08:00
commit eb4f0e4ae9
6 changed files with 38 additions and 21 deletions

View File

@ -12,9 +12,7 @@ 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/bradsk88/python-wink/archive/' REQUIREMENTS = ['python-wink==0.3.1']
'91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#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):

View File

@ -11,9 +11,7 @@ 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/bradsk88/python-wink/archive/' REQUIREMENTS = ['python-wink==0.3.1']
'91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#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,7 @@ 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/bradsk88/python-wink/archive/' REQUIREMENTS = ['python-wink==0.3.1']
'91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.3']
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
@ -32,6 +30,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
pywink.set_bearer_token(token) pywink.set_bearer_token(token)
add_devices(WinkSensorDevice(sensor) for sensor in pywink.get_sensors()) add_devices(WinkSensorDevice(sensor) for sensor in pywink.get_sensors())
add_devices(WinkEggMinder(eggtray) for eggtray in pywink.get_eggtrays())
class WinkSensorDevice(Entity): class WinkSensorDevice(Entity):
@ -48,7 +47,7 @@ class WinkSensorDevice(Entity):
@property @property
def unique_id(self): def unique_id(self):
""" Returns the id of this wink sensor """ """ Returns the id of this wink sensor """
return "{}.{}".format(self.__class__, self.wink.deviceId()) return "{}.{}".format(self.__class__, self.wink.device_id())
@property @property
def name(self): def name(self):
@ -57,9 +56,35 @@ class WinkSensorDevice(Entity):
def update(self): def update(self):
""" Update state of the sensor. """ """ Update state of the sensor. """
self.wink.updateState() self.wink.update_state()
@property @property
def is_open(self): def is_open(self):
""" True if door is open. """ """ True if door is open. """
return self.wink.state() 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()

View File

@ -11,9 +11,7 @@ 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/bradsk88/python-wink/archive/' REQUIREMENTS = ['python-wink==0.3.1']
'91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#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

@ -1,8 +1,7 @@
""" """
homeassistant.components.wink homeassistant.components.wink
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connects to a Wink hub and loads relevant components to control its devices. Connects to a Wink hub and loads relevant components to control its devices.
For more details about this component, please refer to the documentation at For more details about this component, please refer to the documentation at
https://home-assistant.io/components/wink/ https://home-assistant.io/components/wink/
""" """
@ -17,9 +16,7 @@ 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/bradsk88/python-wink/archive/' REQUIREMENTS = ['python-wink==0.3.1']
'91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip'
'#python-wink==0.3']
DISCOVER_LIGHTS = "wink.lights" DISCOVER_LIGHTS = "wink.lights"
DISCOVER_SWITCHES = "wink.switches" DISCOVER_SWITCHES = "wink.switches"
@ -41,7 +38,8 @@ def setup(hass, config):
for component_name, func_exists, discovery_type in ( for component_name, func_exists, discovery_type in (
('light', pywink.get_bulbs, DISCOVER_LIGHTS), ('light', pywink.get_bulbs, DISCOVER_LIGHTS),
('switch', pywink.get_switches, DISCOVER_SWITCHES), ('switch', pywink.get_switches, DISCOVER_SWITCHES),
('sensor', pywink.get_sensors, DISCOVER_SENSORS), ('sensor', lambda: pywink.get_sensors or pywink.get_eggtrays,
DISCOVER_SENSORS),
('lock', pywink.get_locks, DISCOVER_LOCKS)): ('lock', pywink.get_locks, DISCOVER_LOCKS)):
if func_exists(): if func_exists():

View File

@ -63,7 +63,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/bradsk88/python-wink/archive/91c8e9a5df24c8dd1a5267dc29a00a40c11d826a.zip#python-wink==0.3 python-wink==0.3.1
# homeassistant.components.media_player.cast # homeassistant.components.media_player.cast
pychromecast==0.6.12 pychromecast==0.6.12