Added support for Wink Smoke and CO detectors (#3645)

This commit is contained in:
William Scanlon 2016-10-04 04:07:50 -04:00 committed by Paulus Schoutsen
parent a072047d9d
commit 2cf49f3de6
3 changed files with 12 additions and 3 deletions

View file

@ -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()