From 2cf49f3de6c2c921662bb30fd23050bb835b7a42 Mon Sep 17 00:00:00 2001 From: William Scanlon Date: Tue, 4 Oct 2016 04:07:50 -0400 Subject: [PATCH] Added support for Wink Smoke and CO detectors (#3645) --- homeassistant/components/binary_sensor/wink.py | 11 ++++++++++- homeassistant/components/wink.py | 2 +- requirements_all.txt | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/binary_sensor/wink.py b/homeassistant/components/binary_sensor/wink.py index 736643fd8df..9813ca213e6 100644 --- a/homeassistant/components/binary_sensor/wink.py +++ b/homeassistant/components/binary_sensor/wink.py @@ -21,7 +21,9 @@ SENSOR_TYPES = { "loudness": "sound", "liquid_detected": "moisture", "motion": "motion", - "presence": "occupancy" + "presence": "occupancy", + "co_detected": "gas", + "smoke_detected": "smoke" } @@ -36,6 +38,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None): for key in pywink.get_keys(): add_devices([WinkBinarySensorDevice(key)]) + for sensor in pywink.get_smoke_and_co_detectors(): + add_devices([WinkBinarySensorDevice(sensor)]) + class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice, Entity): """Representation of a Wink binary sensor.""" @@ -70,6 +75,10 @@ class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice, Entity): state = self.wink.motion_boolean() elif self.capability == "presence": state = self.wink.presence_boolean() + elif self.capability == "co_detected": + state = self.wink.co_detected_boolean() + elif self.capability == "smoke_detected": + state = self.wink.smoke_detected_boolean() else: state = self.wink.state() diff --git a/homeassistant/components/wink.py b/homeassistant/components/wink.py index d4ce99e6463..2e5e7ebcfb4 100644 --- a/homeassistant/components/wink.py +++ b/homeassistant/components/wink.py @@ -15,7 +15,7 @@ from homeassistant.const import CONF_ACCESS_TOKEN, ATTR_BATTERY_LEVEL, \ from homeassistant.helpers.entity import Entity import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ['python-wink==0.8.0', 'pubnub==3.8.2'] +REQUIREMENTS = ['python-wink==0.9.0', 'pubnub==3.8.2'] _LOGGER = logging.getLogger(__name__) diff --git a/requirements_all.txt b/requirements_all.txt index d80c0aff49a..0e85ce33acf 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -404,7 +404,7 @@ python-telegram-bot==5.1.0 python-twitch==1.3.0 # homeassistant.components.wink -python-wink==0.8.0 +python-wink==0.9.0 # homeassistant.components.keyboard # pyuserinput==0.1.11