mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Wink hub sensor (#4704)
This commit is contained in:
parent
776e53a7f0
commit
ca63e44227
@ -40,6 +40,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for sensor in pywink.get_smoke_and_co_detectors():
|
for sensor in pywink.get_smoke_and_co_detectors():
|
||||||
add_devices([WinkBinarySensorDevice(sensor, hass)])
|
add_devices([WinkBinarySensorDevice(sensor, hass)])
|
||||||
|
|
||||||
|
for hub in pywink.get_hubs():
|
||||||
|
add_devices([WinkHub(hub, hass)])
|
||||||
|
|
||||||
|
|
||||||
class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice, Entity):
|
class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice, Entity):
|
||||||
"""Representation of a Wink binary sensor."""
|
"""Representation of a Wink binary sensor."""
|
||||||
@ -79,3 +82,24 @@ class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice, Entity):
|
|||||||
def sensor_class(self):
|
def sensor_class(self):
|
||||||
"""Return the class of this sensor, from SENSOR_CLASSES."""
|
"""Return the class of this sensor, from SENSOR_CLASSES."""
|
||||||
return SENSOR_TYPES.get(self.capability)
|
return SENSOR_TYPES.get(self.capability)
|
||||||
|
|
||||||
|
|
||||||
|
class WinkHub(WinkDevice, BinarySensorDevice, Entity):
|
||||||
|
"""Representation of a Wink Hub."""
|
||||||
|
|
||||||
|
def __init(self, wink, hass):
|
||||||
|
"""Initialize the hub sensor."""
|
||||||
|
WinkDevice.__init__(self, wink, hass)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_state_attributes(self):
|
||||||
|
"""Return the state attributes."""
|
||||||
|
return {
|
||||||
|
'update needed': self.wink.update_needed(),
|
||||||
|
'firmware version': self.wink.firmware_version()
|
||||||
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_on(self):
|
||||||
|
"""Return true if the binary sensor is on."""
|
||||||
|
return self.wink.state()
|
||||||
|
@ -15,7 +15,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['python-wink==0.10.1', 'pubnubsub-handler==0.0.5']
|
REQUIREMENTS = ['python-wink==0.11.0', 'pubnubsub-handler==0.0.5']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ python-telegram-bot==5.2.0
|
|||||||
python-twitch==1.3.0
|
python-twitch==1.3.0
|
||||||
|
|
||||||
# homeassistant.components.wink
|
# homeassistant.components.wink
|
||||||
python-wink==0.10.1
|
python-wink==0.11.0
|
||||||
|
|
||||||
# homeassistant.components.keyboard
|
# homeassistant.components.keyboard
|
||||||
# pyuserinput==0.1.11
|
# pyuserinput==0.1.11
|
||||||
|
Loading…
x
Reference in New Issue
Block a user