1 """Support for Lutron Powr Savr occupancy sensors."""
3 from __future__
import annotations
5 from collections.abc
import Mapping
9 from pylutron
import OccupancyGroup
12 BinarySensorDeviceClass,
19 from .
import DOMAIN, LutronData
20 from .entity
import LutronDevice
22 _LOGGER = logging.getLogger(__name__)
27 config_entry: ConfigEntry,
28 async_add_entities: AddEntitiesCallback,
30 """Set up the Lutron binary_sensor platform.
32 Adds occupancy groups from the Main Repeater associated with the
33 config_entry as binary_sensor entities.
35 entry_data: LutronData = hass.data[DOMAIN][config_entry.entry_id]
39 for area_name, device
in entry_data.binary_sensors
46 """Representation of a Lutron Occupancy Group.
48 The Lutron integration API reports "occupancy groups" rather than
49 individual sensors. If two sensors are in the same room, they're
50 reported as a single occupancy group.
53 _lutron_device: OccupancyGroup
54 _attr_device_class = BinarySensorDeviceClass.OCCUPANCY
58 """Return the state attributes."""
59 return {
"lutron_integration_id": self.
_lutron_device_lutron_device.id}
62 """Update the state attributes."""
Mapping[str, Any]|None extra_state_attributes(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)