Added support for Wink Smoke and CO detectors (#3645)
This commit is contained in:
parent
a072047d9d
commit
2cf49f3de6
3 changed files with 12 additions and 3 deletions
|
@ -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()
|
||||
|
||||
|
|
|
@ -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__)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue