1 """Support for MAX! binary sensors via MAX! Cube."""
3 from __future__
import annotations
6 BinarySensorDeviceClass,
14 from .
import DATA_KEY
20 add_entities: AddEntitiesCallback,
21 discovery_info: DiscoveryInfoType |
None =
None,
23 """Iterate through all MAX! Devices and add window shutters."""
24 devices: list[MaxCubeBinarySensorBase] = []
25 for handler
in hass.data[DATA_KEY].values():
26 for device
in handler.cube.devices:
29 if device.is_windowshutter():
36 """Base class for maxcube binary sensors."""
38 _attr_entity_category = EntityCategory.DIAGNOSTIC
41 """Initialize MAX! Cube BinarySensorEntity."""
44 self.
_room_room = handler.cube.room_by_id(device.room_id)
47 """Get latest data from MAX! Cube."""
52 """Representation of a MAX! Cube Binary Sensor device."""
54 _attr_device_class = BinarySensorDeviceClass.WINDOW
57 """Initialize MAX! Cube BinarySensorEntity."""
60 self.
_attr_name_attr_name = f
"{self._room.name} {self._device.name}"
65 """Return true if the binary sensor is on/open."""
66 return self.
_device_device.is_open
70 """Representation of a MAX! Cube Binary Sensor device."""
72 _attr_device_class = BinarySensorDeviceClass.BATTERY
75 """Initialize MAX! Cube BinarySensorEntity."""
78 self.
_attr_name_attr_name = f
"{self._room.name} {device.name} battery"
83 """Return true if the binary sensor is on/open."""
84 return self.
_device_device.battery == 1
def __init__(self, handler, device)
def __init__(self, handler, device)
def __init__(self, handler, device)
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)