1 """Support for yalexs ble binary sensors."""
3 from __future__
import annotations
5 from yalexs_ble
import ConnectionInfo, DoorStatus, LockInfo, LockState
8 BinarySensorDeviceClass,
14 from .
import YALEXSBLEConfigEntry
15 from .entity
import YALEXSBLEEntity
20 entry: YALEXSBLEConfigEntry,
21 async_add_entities: AddEntitiesCallback,
23 """Set up YALE XS binary sensors."""
24 data = entry.runtime_data
26 if lock.lock_info
and lock.lock_info.door_sense:
31 """Yale XS BLE binary sensor."""
33 _attr_device_class = BinarySensorDeviceClass.DOOR
37 self, new_state: LockState, lock_info: LockInfo, connection_info: ConnectionInfo
39 """Update the state."""
40 self.
_attr_is_on_attr_is_on = new_state.door == DoorStatus.OPENED
None _async_update_state(self, LockState new_state, LockInfo lock_info, ConnectionInfo connection_info)
None async_setup_entry(HomeAssistant hass, YALEXSBLEConfigEntry entry, AddEntitiesCallback async_add_entities)