This commit is contained in:
Paulus Schoutsen committed 2019-07-31 12:25:30 -07:00
1 parent da05dfe708
commit 4de97abc3a
2676 files changed
+163166 -140084

No files matched your search

+11 -9
View File
@@ -1,8 +1,12 @@
"""Hue binary sensor entities."""
from homeassistant.components.binary_sensor import (
BinarySensorDevice, DEVICE_CLASS_MOTION)
BinarySensorDevice,
DEVICE_CLASS_MOTION,
)
from homeassistant.components.hue.sensor_base import (
GenericZLLSensor, async_setup_entry as shared_async_setup_entry)
GenericZLLSensor,
async_setup_entry as shared_async_setup_entry,
)
PRESENCE_NAME_FORMAT = "{} motion"
@@ -10,8 +14,7 @@ PRESENCE_NAME_FORMAT = "{} motion"
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Defer binary sensor setup to the shared sensor module."""
await shared_async_setup_entry(
hass, config_entry, async_add_entities, binary=True)
await shared_async_setup_entry(hass, config_entry, async_add_entities, binary=True)
class HuePresence(GenericZLLSensor, BinarySensorDevice):
@@ -31,9 +34,8 @@ class HuePresence(GenericZLLSensor, BinarySensorDevice):
def device_state_attributes(self):
"""Return the device state attributes."""
attributes = super().device_state_attributes
if 'sensitivity' in self.sensor.config:
attributes['sensitivity'] = self.sensor.config['sensitivity']
if 'sensitivitymax' in self.sensor.config:
attributes['sensitivity_max'] = \
self.sensor.config['sensitivitymax']
if "sensitivity" in self.sensor.config:
attributes["sensitivity"] = self.sensor.config["sensitivity"]
if "sensitivitymax" in self.sensor.config:
attributes["sensitivity_max"] = self.sensor.config["sensitivitymax"]
return attributes