1 """Describe logbook events."""
3 from __future__
import annotations
5 from collections.abc
import Callable
8 LOGBOOK_ENTRY_ENTITY_ID,
15 from .const
import DOMAIN
16 from .util
import async_get_entries
22 async_describe_event: Callable[
23 [str, str, Callable[[Event], dict[str, str |
None]]],
None
26 """Describe logbook events."""
29 def async_describe_logbook_event(event: Event) -> dict[str, str |
None]:
30 """Describe a logbook event."""
32 LOGBOOK_ENTRY_NAME:
"Doorbird",
33 LOGBOOK_ENTRY_MESSAGE: f
"Event {event.event_type} was fired",
35 LOGBOOK_ENTRY_ENTITY_ID: event.data.get(ATTR_ENTITY_ID),
39 data = entry.runtime_data
40 for event
in data.door_station.door_station_events:
42 DOMAIN, f
"{DOMAIN}_{event}", async_describe_logbook_event
None async_describe_events(HomeAssistant hass, Callable[[str, str, Callable[[Event], dict[str, str|None]]], None] async_describe_event)
list[DoorBirdConfigEntry] async_get_entries(HomeAssistant hass)