1 """DoorBird integration utils."""
3 from typing
import Any, cast
7 from .const
import DOMAIN
8 from .device
import ConfiguredDoorBird
9 from .models
import DoorBirdConfigEntry
13 """Get the mac address depending on the device type."""
14 return door_station_info.get(
"PRIMARY_MAC_ADDR", door_station_info[
"WIFI_MAC_ADDR"])
18 hass: HomeAssistant, token: str
19 ) -> ConfiguredDoorBird |
None:
20 """Get door station by token."""
22 door_station = entry.runtime_data.door_station
23 if door_station.token == token:
30 """Get all the doorbird entries."""
31 entries = hass.config_entries.async_entries(
32 DOMAIN, include_ignore=
True, include_disabled=
True
34 active_entries = [entry
for entry
in entries
if hasattr(entry,
"runtime_data")]
35 return cast(list[DoorBirdConfigEntry], active_entries)
ConfiguredDoorBird|None get_door_station_by_token(HomeAssistant hass, str token)
str get_mac_address_from_door_station_info(dict[str, Any] door_station_info)
list[DoorBirdConfigEntry] async_get_entries(HomeAssistant hass)