1 """The yalexs_ble integration entities."""
3 from __future__
import annotations
5 from yalexs_ble
import ConnectionInfo, LockInfo, LockState
13 from .const
import DOMAIN
14 from .models
import YaleXSBLEData
18 """Base class for yale xs ble entities."""
20 _attr_has_entity_name =
True
21 _attr_should_poll =
False
23 def __init__(self, data: YaleXSBLEData) ->
None:
24 """Initialize the entity."""
28 lock_state = device.lock_state
29 lock_info = device.lock_info
30 connection_info = device.connection_info
31 assert lock_state
is not None
32 assert connection_info
is not None
33 assert lock_info
is not None
37 manufacturer=lock_info.manufacturer,
38 model=lock_info.model,
39 connections={(dr.CONNECTION_BLUETOOTH, device.address)},
40 identifiers={(DOMAIN, lock_info.serial)},
41 sw_version=lock_info.firmware,
48 self, new_state: LockState, lock_info: LockInfo, connection_info: ConnectionInfo
50 """Update the state."""
55 self, new_state: LockState, lock_info: LockInfo, connection_info: ConnectionInfo
57 """Handle state changed."""
63 self, _service_info: bluetooth.BluetoothServiceInfoBleak
65 """Handle device not longer being seen by the bluetooth stack."""
70 """Register callbacks."""
72 bluetooth.async_track_unavailable(
80 """Request a manual update."""
None _async_update_state(self, LockState new_state, LockInfo lock_info, ConnectionInfo connection_info)
None _async_device_unavailable(self, bluetooth.BluetoothServiceInfoBleak _service_info)
None __init__(self, YaleXSBLEData data)
None _async_state_changed(self, LockState new_state, LockInfo lock_info, ConnectionInfo connection_info)
None async_added_to_hass(self)
None async_write_ha_state(self)
None async_on_remove(self, CALLBACK_TYPE func)