1 """Hue binary sensor entities."""
3 from aiohue.v1.sensors
import TYPE_ZLL_PRESENCE
6 BinarySensorDeviceClass,
10 from ..const
import DOMAIN
as HUE_DOMAIN
11 from .sensor_base
import SENSOR_CONFIG_MAP, GenericZLLSensor
13 PRESENCE_NAME_FORMAT =
"{} motion"
17 """Defer binary sensor setup to the shared sensor module."""
18 bridge = hass.data[HUE_DOMAIN][config_entry.entry_id]
20 if not bridge.sensor_manager:
23 await bridge.sensor_manager.async_register_component(
24 "binary_sensor", async_add_entities
30 """The presence sensor entity for a Hue motion sensor device."""
32 _attr_device_class = BinarySensorDeviceClass.MOTION
36 """Return true if the binary sensor is on."""
37 return self.
sensorsensor.presence
41 """Return the device state attributes."""
42 attributes = super().extra_state_attributes
43 if "sensitivity" in self.
sensorsensor.config:
44 attributes[
"sensitivity"] = self.
sensorsensor.config[
"sensitivity"]
45 if "sensitivitymax" in self.
sensorsensor.config:
46 attributes[
"sensitivity_max"] = self.
sensorsensor.config[
"sensitivitymax"]
50 SENSOR_CONFIG_MAP.update(
53 "platform":
"binary_sensor",
54 "name_format": PRESENCE_NAME_FORMAT,
def extra_state_attributes(self)
def async_setup_entry(hass, config_entry, async_add_entities)