Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Event parser and human readable log generator."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.components.automation import EVENT_AUTOMATION_TRIGGERED
6 from homeassistant.components.script import EVENT_SCRIPT_STARTED
7 from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
8 from homeassistant.const import EVENT_CALL_SERVICE, EVENT_LOGBOOK_ENTRY
9 
10 #
11 # Domains that are always continuous
12 #
13 # These are hard coded here to avoid importing
14 # the entire counter and proximity integrations
15 # to get the name of the domain.
16 ALWAYS_CONTINUOUS_DOMAINS = {"counter", "proximity"}
17 
18 # Domains that are continuous if there is a UOM set on the entity
19 CONDITIONALLY_CONTINUOUS_DOMAINS = {SENSOR_DOMAIN}
20 
21 ATTR_MESSAGE = "message"
22 
23 DOMAIN = "logbook"
24 
25 CONTEXT_USER_ID = "context_user_id"
26 CONTEXT_ENTITY_ID = "context_entity_id"
27 CONTEXT_ENTITY_ID_NAME = "context_entity_id_name"
28 CONTEXT_EVENT_TYPE = "context_event_type"
29 CONTEXT_DOMAIN = "context_domain"
30 CONTEXT_STATE = "context_state"
31 CONTEXT_SOURCE = "context_source"
32 CONTEXT_SERVICE = "context_service"
33 CONTEXT_NAME = "context_name"
34 CONTEXT_MESSAGE = "context_message"
35 
36 LOGBOOK_ENTRY_CONTEXT_ID = "context_id"
37 LOGBOOK_ENTRY_DOMAIN = "domain"
38 LOGBOOK_ENTRY_ENTITY_ID = "entity_id"
39 LOGBOOK_ENTRY_ICON = "icon"
40 LOGBOOK_ENTRY_SOURCE = "source"
41 LOGBOOK_ENTRY_MESSAGE = "message"
42 LOGBOOK_ENTRY_NAME = "name"
43 LOGBOOK_ENTRY_STATE = "state"
44 LOGBOOK_ENTRY_WHEN = "when"
45 
46 # Automation events that can affect an entity_id or device_id
47 AUTOMATION_EVENTS = {EVENT_AUTOMATION_TRIGGERED, EVENT_SCRIPT_STARTED}
48 
49 # Events that are built-in to the logbook or core
50 BUILT_IN_EVENTS = {EVENT_LOGBOOK_ENTRY, EVENT_CALL_SERVICE}