1 """Allow to set up simple automation rules via the config file."""
3 from __future__
import annotations
5 from abc
import ABC, abstractmethod
7 from collections.abc
import Callable, Mapping
8 from dataclasses
import dataclass
9 from functools
import partial
11 from typing
import Any, Protocol, cast
13 from propcache
import cached_property
14 import voluptuous
as vol
33 EVENT_HOMEASSISTANT_STARTED,
56 all_with_deprecated_constants,
57 check_if_deprecated_constant,
58 dir_with_deprecated_constants,
80 async_register_admin_service,
93 async_initialize_triggers,
100 from .config
import AutomationConfig, ValidationStatus
105 CONF_TRIGGER_VARIABLES,
107 DEFAULT_INITIAL_STATE,
111 from .helpers
import async_get_blueprints
112 from .trace
import trace_automation
114 DATA_COMPONENT: HassKey[EntityComponent[BaseAutomationEntity]] =
HassKey(DOMAIN)
115 ENTITY_ID_FORMAT = DOMAIN +
".{}"
118 CONF_SKIP_CONDITION =
"skip_condition"
119 CONF_STOP_ACTIONS =
"stop_actions"
120 DEFAULT_STOP_ACTIONS =
True
122 EVENT_AUTOMATION_RELOADED =
"automation_reloaded"
123 EVENT_AUTOMATION_TRIGGERED =
"automation_triggered"
125 ATTR_LAST_TRIGGERED =
"last_triggered"
126 ATTR_SOURCE =
"source"
127 ATTR_VARIABLES =
"variables"
128 SERVICE_TRIGGER =
"trigger"
132 """Define the format of if_action."""
134 config: list[ConfigType]
136 def __call__(self, variables: Mapping[str, Any] |
None =
None) -> bool:
137 """AND all conditions."""
144 TriggerActionType,
"TriggerActionType",
"2025.1"
147 TriggerData,
"TriggerData",
"2025.1"
150 TriggerInfo,
"TriggerInfo",
"2025.1"
155 def is_on(hass: HomeAssistant, entity_id: str) -> bool:
156 """Return true if specified automation entity_id is on.
160 return hass.states.is_state(entity_id, STATE_ON)
164 hass: HomeAssistant, referenced_id: str, property_name: str
166 """Return all automations that reference the x."""
167 if DATA_COMPONENT
not in hass.data:
171 automation_entity.entity_id
172 for automation_entity
in hass.data[DATA_COMPONENT].entities
173 if referenced_id
in getattr(automation_entity, property_name)
178 hass: HomeAssistant, entity_id: str, property_name: str
180 """Return all x in an automation."""
181 if DATA_COMPONENT
not in hass.data:
184 if (automation_entity := hass.data[DATA_COMPONENT].
get_entity(entity_id))
is None:
187 return list(getattr(automation_entity, property_name))
192 """Return all automations that reference the entity."""
198 """Return all entities in an automation."""
204 """Return all automations that reference the device."""
210 """Return all devices in an automation."""
216 """Return all automations that reference the area."""
222 """Return all areas in an automation."""
228 """Return all automations that reference the floor."""
234 """Return all floors in an automation."""
240 """Return all automations that reference the label."""
246 """Return all labels in an automation."""
252 """Return all automations that reference the blueprint."""
253 if DOMAIN
not in hass.data:
257 automation_entity.entity_id
258 for automation_entity
in hass.data[DATA_COMPONENT].entities
259 if automation_entity.referenced_blueprint == blueprint_path
265 """Return the blueprint the automation is based on or None."""
266 if DATA_COMPONENT
not in hass.data:
269 if (automation_entity := hass.data[DATA_COMPONENT].
get_entity(entity_id))
is None:
272 return automation_entity.referenced_blueprint
275 async
def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
276 """Set up all automations."""
277 hass.data[DATA_COMPONENT] = component = EntityComponent[BaseAutomationEntity](
291 hass.async_create_task(
295 async
def trigger_service_handler(
296 entity: BaseAutomationEntity, service_call: ServiceCall
298 """Handle forced automation trigger, e.g. from frontend."""
299 await entity.async_trigger(
300 {**service_call.data[ATTR_VARIABLES],
"trigger": {
"platform":
None}},
301 skip_condition=service_call.data[CONF_SKIP_CONDITION],
302 context=service_call.context,
305 component.async_register_entity_service(
308 vol.Optional(ATTR_VARIABLES, default={}): dict,
309 vol.Optional(CONF_SKIP_CONDITION, default=
True): bool,
311 trigger_service_handler,
313 component.async_register_entity_service(SERVICE_TOGGLE,
None,
"async_toggle")
314 component.async_register_entity_service(SERVICE_TURN_ON,
None,
"async_turn_on")
315 component.async_register_entity_service(
317 {vol.Optional(CONF_STOP_ACTIONS, default=DEFAULT_STOP_ACTIONS): cv.boolean},
321 async
def reload_service_handler(service_call: ServiceCall) ->
None:
322 """Remove all automations and load new ones from config."""
324 if (conf := await component.async_prepare_reload(skip_reset=
True))
is None:
326 if automation_id := service_call.data.get(CONF_ID):
330 hass.bus.async_fire(EVENT_AUTOMATION_RELOADED, context=service_call.context)
332 def reload_targets(service_call: ServiceCall) -> set[str |
None]:
333 if automation_id := service_call.data.get(CONF_ID):
334 return {automation_id}
335 return {automation.unique_id
for automation
in component.entities}
343 reload_helper.execute_service,
344 schema=vol.Schema({vol.Optional(CONF_ID): str}),
347 websocket_api.async_register_command(hass, websocket_config)
353 """Base class for automation entities."""
355 _entity_component_unrecorded_attributes = frozenset(
356 (ATTR_LAST_TRIGGERED, ATTR_MODE, ATTR_CUR, ATTR_MAX, CONF_ID)
358 raw_config: ConfigType |
None
362 """Return capability attributes."""
364 return {CONF_ID: self.
unique_idunique_id}
370 """Return a set of referenced labels."""
375 """Return a set of referenced floors."""
380 """Return a set of referenced areas."""
385 """Return referenced blueprint or None."""
390 """Return a set of referenced devices."""
395 """Return a set of referenced entities."""
400 run_variables: dict[str, Any],
401 context: Context |
None =
None,
402 skip_condition: bool =
False,
403 ) -> ScriptRunResult |
None:
404 """Trigger automation."""
408 """A non-functional automation entity with its state set to unavailable.
410 This class is instantiated when an automation fails to validate.
413 _attr_should_poll =
False
414 _attr_available =
False
418 automation_id: str |
None,
420 raw_config: ConfigType |
None,
421 validation_error: str,
422 validation_status: ValidationStatus,
424 """Initialize an automation entity."""
433 """Return a set of referenced labels."""
438 """Return a set of referenced floors."""
443 """Return a set of referenced areas."""
448 """Return referenced blueprint or None."""
453 """Return a set of referenced devices."""
458 """Return a set of referenced entities."""
462 """Create a repair issue to notify the user the automation has errors."""
467 f
"{self.entity_id}_validation_{self._validation_status}",
469 severity=IssueSeverity.ERROR,
470 translation_key=f
"validation_{self._validation_status}",
471 translation_placeholders={
472 "edit": f
"/config/automation/edit/{self.unique_id}",
482 self.
hasshass, DOMAIN, f
"{self.entity_id}_validation_{self._validation_status}"
487 run_variables: dict[str, Any],
488 context: Context |
None =
None,
489 skip_condition: bool =
False,
491 """Trigger automation."""
495 """Entity to show status of entity."""
497 _attr_should_poll =
False
501 automation_id: str |
None,
503 trigger_config: list[ConfigType],
504 cond_func: IfAction |
None,
505 action_script: Script,
506 initial_state: bool |
None,
507 variables: ScriptVariables |
None,
508 trigger_variables: ScriptVariables |
None,
509 raw_config: ConfigType |
None,
510 blueprint_inputs: ConfigType |
None,
511 trace_config: ConfigType,
513 """Initialize an automation entity."""
532 """Return the entity state attributes."""
534 ATTR_LAST_TRIGGERED: self.
action_scriptaction_script.last_triggered,
544 """Return True if entity is on."""
549 """Return a set of referenced labels."""
554 """Return a set of referenced floors."""
559 """Return a set of referenced areas."""
564 """Return referenced blueprint or None."""
567 return cast(str, self.
_blueprint_inputs_blueprint_inputs[CONF_USE_BLUEPRINT][CONF_PATH])
571 """Return a set of referenced devices."""
572 referenced = self.
action_scriptaction_script.referenced_devices
576 referenced |= condition.async_extract_devices(conf)
585 """Return a set of referenced entities."""
586 referenced = self.
action_scriptaction_script.referenced_entities
590 referenced |= condition.async_extract_entities(conf)
594 referenced.add(entity_id)
599 """Startup with initial state or previous state."""
602 self.
_logger_logger = logging.getLogger(
603 f
"{__name__}.{split_entity_id(self.entity_id)[1]}"
608 enable_automation = state.state == STATE_ON
609 last_triggered = state.attributes.get(
"last_triggered")
610 if last_triggered
is not None:
613 "Loaded automation %s with state %s from state storage last state %s",
619 enable_automation = DEFAULT_INITIAL_STATE
621 "Automation %s not in state storage, state %s from default is used",
629 "Automation %s initial state %s overridden from config initial_state",
634 if enable_automation:
638 """Turn the entity on and update the state."""
643 """Turn the entity off."""
644 if CONF_STOP_ACTIONS
in kwargs:
645 await self.
_async_disable_async_disable(kwargs[CONF_STOP_ACTIONS])
652 run_variables: dict[str, Any],
653 context: Context |
None =
None,
654 skip_condition: bool =
False,
655 ) -> ScriptRunResult |
None:
656 """Trigger automation.
658 This method is a coroutine.
662 if "trigger" in run_variables:
663 if "description" in run_variables[
"trigger"]:
664 reason = f
' by {run_variables["trigger"]["description"]}'
665 if "alias" in run_variables[
"trigger"]:
666 alias = f
' trigger \'{run_variables["trigger"]["alias"]}\''
667 self.
_logger_logger.debug(
"Automation%s triggered%s", alias, reason)
670 parent_id =
None if context
is None else context.id
671 trigger_context =
Context(parent_id=parent_id)
680 )
as automation_trace:
682 if state := self.
hasshass.states.get(self.
entity_identity_id):
683 this = state.as_dict()
684 variables: dict[str, Any] = {
"this": this, **(run_variables
or {})}
687 variables = self.
_variables_variables.async_render(self.
hasshass, variables)
688 except TemplateError
as err:
689 self.
_logger_logger.error(
"Error rendering variables: %s", err)
690 automation_trace.set_error(err)
697 trigger_description = variables.get(
"trigger", {}).
get(
"description")
698 automation_trace.set_trigger_description(trigger_description)
701 if "trigger" in variables
and "idx" in variables[
"trigger"]:
702 trigger_path = f
"trigger/{variables['trigger']['idx']}"
704 trigger_path =
"trigger"
714 "Conditions not met, aborting automation. Condition summary: %s",
722 ATTR_NAME: self.
namename,
725 if "trigger" in variables
and "description" in variables[
"trigger"]:
726 event_data[ATTR_SOURCE] = variables[
"trigger"][
"description"]
729 def started_action() -> None:
733 self.
hasshass.bus.async_fire_internal(
734 EVENT_AUTOMATION_TRIGGERED, event_data, context=trigger_context
739 script_stack_cv.set([])
744 variables, trigger_context, started_action
746 except ServiceNotFound
as err:
750 f
"{self.entity_id}_service_not_found_{err.domain}.{err.service}",
753 severity=IssueSeverity.ERROR,
754 translation_key=
"service_not_found",
755 translation_placeholders={
756 "service": f
"{err.domain}.{err.service}",
759 "edit": f
"/config/automation/edit/{self.unique_id}",
762 automation_trace.set_error(err)
763 except (vol.Invalid, HomeAssistantError)
as err:
765 "Error while executing automation %s: %s",
769 automation_trace.set_error(err)
770 except Exception
as err:
771 self.
_logger_logger.exception(
"While executing automation %s", self.
entity_identity_id)
772 automation_trace.set_error(err)
777 """Remove listeners when removing automation from Home Assistant."""
782 """Start automation on startup."""
791 """Enable this automation entity.
793 This method is not expected to write state to the
801 if self.
hasshass.state
is not CoreState.not_running:
805 self.
hasshass.bus.async_listen_once(
806 EVENT_HOMEASSISTANT_STARTED,
810 async
def _async_disable(self, stop_actions: bool = DEFAULT_STOP_ACTIONS) ->
None:
811 """Disable the automation entity.
813 This method is not expected to write state to the
829 """Log helper callback."""
830 self.
_logger_logger.log(level,
"%s %s", msg, self.
namename, **kwargs)
834 run_variables: dict[str, Any],
835 context: Context |
None =
None,
836 skip_condition: bool =
False,
837 ) -> ScriptRunResult |
None:
838 """Trigger automation if enabled.
840 If the trigger starts but has a delay, the automation will be triggered
841 when the delay has passed so we need to make sure its still enabled before
842 executing the action.
849 self, home_assistant_start: bool
850 ) -> Callable[[],
None] |
None:
851 """Set up the triggers."""
853 if state := self.
hasshass.states.get(self.
entity_identity_id):
854 this = state.as_dict()
855 variables = {
"this": this}
863 except TemplateError
as err:
864 self.
_logger_logger.error(
"Error rendering trigger variables: %s", err)
874 home_assistant_start,
879 @dataclass(slots=True)
881 """Container for prepared automation entity configuration."""
883 config_block: ConfigType
885 raw_blueprint_inputs: ConfigType |
None
886 raw_config: ConfigType |
None
887 validation_error: str |
None
888 validation_status: ValidationStatus
894 wanted_automation_id: str |
None,
895 ) -> list[AutomationEntityConfig]:
896 """Parse configuration and prepare automation entity configuration."""
897 automation_configs: list[AutomationEntityConfig] = []
899 conf: list[ConfigType] = config[DOMAIN]
901 for list_no, config_block
in enumerate(conf):
902 automation_id: str |
None = config_block.get(CONF_ID)
903 if wanted_automation_id
is not None and automation_id != wanted_automation_id:
906 raw_config = cast(AutomationConfig, config_block).raw_config
907 raw_blueprint_inputs = cast(AutomationConfig, config_block).raw_blueprint_inputs
908 validation_error = cast(AutomationConfig, config_block).validation_error
909 validation_status = cast(AutomationConfig, config_block).validation_status
910 automation_configs.append(
914 raw_blueprint_inputs,
921 return automation_configs
925 """Return the configured name of an automation."""
926 config_block = automation_config.config_block
927 list_no = automation_config.list_no
928 return config_block.get(CONF_ALIAS)
or f
"{DOMAIN} {list_no}"
932 hass: HomeAssistant, automation_configs: list[AutomationEntityConfig]
933 ) -> list[BaseAutomationEntity]:
934 """Create automation entities from prepared configuration."""
935 entities: list[BaseAutomationEntity] = []
937 for automation_config
in automation_configs:
938 config_block = automation_config.config_block
940 automation_id: str |
None = config_block.get(CONF_ID)
943 if automation_config.validation_status != ValidationStatus.OK:
948 automation_config.raw_config,
949 cast(str, automation_config.validation_error),
950 automation_config.validation_status,
955 initial_state: bool |
None = config_block.get(CONF_INITIAL_STATE)
959 config_block[CONF_ACTIONS],
962 running_description=
"automation actions",
963 script_mode=config_block[CONF_MODE],
964 max_runs=config_block[CONF_MAX],
965 max_exceeded=config_block[CONF_MAX_EXCEEDED],
972 if CONF_CONDITIONS
in config_block:
975 if cond_func
is None:
982 if CONF_TRIGGER_VARIABLES
in config_block
and CONF_VARIABLES
in config_block:
984 dict(config_block[CONF_TRIGGER_VARIABLES].as_dict())
986 variables.variables.update(config_block[CONF_VARIABLES].as_dict())
987 elif CONF_TRIGGER_VARIABLES
in config_block:
988 variables = config_block[CONF_TRIGGER_VARIABLES]
989 elif CONF_VARIABLES
in config_block:
990 variables = config_block[CONF_VARIABLES]
995 config_block[CONF_TRIGGERS],
1000 config_block.get(CONF_TRIGGER_VARIABLES),
1001 automation_config.raw_config,
1002 automation_config.raw_blueprint_inputs,
1003 config_block[CONF_TRACE],
1005 entities.append(entity)
1011 hass: HomeAssistant,
1012 config: dict[str, Any],
1013 component: EntityComponent[BaseAutomationEntity],
1015 """Process config and add automations."""
1017 def automation_matches_config(
1018 automation: BaseAutomationEntity, config: AutomationEntityConfig
1021 return automation.name == name
and automation.raw_config == config.raw_config
1024 automations: list[BaseAutomationEntity],
1025 automation_configs: list[AutomationEntityConfig],
1026 ) -> tuple[set[int], set[int]]:
1027 """Find matches between a list of automation entities and a list of configurations.
1029 An automation or configuration is only allowed to match at most once to handle
1030 the case of multiple automations with identical configuration.
1032 Returns a tuple of sets of indices: ({automation_matches}, {config_matches})
1034 automation_matches: set[int] = set()
1035 config_matches: set[int] = set()
1036 automation_configs_with_id: dict[str, tuple[int, AutomationEntityConfig]] = {}
1037 automation_configs_without_id: list[tuple[int, AutomationEntityConfig]] = []
1039 for config_idx, automation_config
in enumerate(automation_configs):
1040 if automation_id := automation_config.config_block.get(CONF_ID):
1041 automation_configs_with_id[automation_id] = (
1046 automation_configs_without_id.append((config_idx, automation_config))
1048 for automation_idx, automation
in enumerate(automations):
1049 if automation.unique_id:
1050 if automation.unique_id
not in automation_configs_with_id:
1052 config_idx, automation_config = automation_configs_with_id.pop(
1053 automation.unique_id
1055 if automation_matches_config(automation, automation_config):
1056 automation_matches.add(automation_idx)
1057 config_matches.add(config_idx)
1060 for config_idx, automation_config
in automation_configs_without_id:
1061 if config_idx
in config_matches:
1064 if automation_matches_config(automation, automation_config):
1065 automation_matches.add(automation_idx)
1066 config_matches.add(config_idx)
1070 return automation_matches, config_matches
1073 automations: list[BaseAutomationEntity] =
list(component.entities)
1076 automation_matches, config_matches = find_matches(automations, automation_configs)
1080 automation.async_remove()
1081 for idx, automation
in enumerate(automations)
1082 if idx
not in automation_matches
1084 await asyncio.gather(*tasks)
1087 updated_automation_configs = [
1089 for idx, config
in enumerate(automation_configs)
1090 if idx
not in config_matches
1093 await component.async_add_entities(entities)
1097 automation: BaseAutomationEntity |
None, config: AutomationEntityConfig |
None
1099 """Return False if an automation's config has been changed."""
1105 return automation.name == name
and automation.raw_config == config.raw_config
1109 hass: HomeAssistant,
1110 config: dict[str, Any],
1111 component: EntityComponent[BaseAutomationEntity],
1114 """Process config and add a single automation."""
1118 (x
for x
in component.entities
if x.unique_id == automation_id),
None
1120 automation_config = automation_configs[0]
if automation_configs
else None
1126 await automation.async_remove()
1128 await component.async_add_entities(entities)
1132 hass: HomeAssistant, name: str, config: dict[str, Any]
1133 ) -> IfAction |
None:
1134 """Process if checks."""
1135 if_configs = config[CONF_CONDITIONS]
1138 if_action = await condition.async_conditions_from_config(
1139 hass, if_configs, LOGGER, name
1141 except HomeAssistantError
as ex:
1142 LOGGER.warning(
"Invalid condition: %s", ex)
1145 result: IfAction = if_action
1146 result.config = if_configs
1153 """Extract devices from a trigger config."""
1154 if trigger_conf[CONF_PLATFORM] ==
"device":
1155 return [trigger_conf[CONF_DEVICE_ID]]
1158 trigger_conf[CONF_PLATFORM] ==
"event"
1159 and CONF_EVENT_DATA
in trigger_conf
1160 and CONF_DEVICE_ID
in trigger_conf[CONF_EVENT_DATA]
1161 and isinstance(trigger_conf[CONF_EVENT_DATA][CONF_DEVICE_ID], str)
1163 return [trigger_conf[CONF_EVENT_DATA][CONF_DEVICE_ID]]
1165 if trigger_conf[CONF_PLATFORM] ==
"tag" and CONF_DEVICE_ID
in trigger_conf:
1166 return trigger_conf[CONF_DEVICE_ID]
1173 """Extract entities from a trigger config."""
1174 if trigger_conf[CONF_PLATFORM]
in (
"state",
"numeric_state"):
1175 return trigger_conf[CONF_ENTITY_ID]
1177 if trigger_conf[CONF_PLATFORM] ==
"calendar":
1178 return [trigger_conf[CONF_ENTITY_ID]]
1180 if trigger_conf[CONF_PLATFORM] ==
"zone":
1181 return trigger_conf[CONF_ENTITY_ID] + [trigger_conf[CONF_ZONE]]
1183 if trigger_conf[CONF_PLATFORM] ==
"geo_location":
1184 return [trigger_conf[CONF_ZONE]]
1186 if trigger_conf[CONF_PLATFORM] ==
"sun":
1190 trigger_conf[CONF_PLATFORM] ==
"event"
1191 and CONF_EVENT_DATA
in trigger_conf
1192 and CONF_ENTITY_ID
in trigger_conf[CONF_EVENT_DATA]
1193 and isinstance(trigger_conf[CONF_EVENT_DATA][CONF_ENTITY_ID], str)
1196 return [trigger_conf[CONF_EVENT_DATA][CONF_ENTITY_ID]]
1201 @websocket_api.websocket_command({"type": "automation/config", "entity_id": str})
1203 hass: HomeAssistant,
1205 msg: dict[str, Any],
1207 """Get automation config."""
1208 automation = hass.data[DATA_COMPONENT].
get_entity(msg[
"entity_id"])
1210 if automation
is None:
1211 connection.send_error(
1212 msg[
"id"], websocket_api.ERR_NOT_FOUND,
"Entity not found"
1216 connection.send_result(
1219 "config": automation.raw_config,
1225 __getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
1227 dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
set[str] referenced_areas(self)
None async_will_remove_from_hass(self)
None async_turn_off(self, **Any kwargs)
None async_added_to_hass(self)
dict[str, Any] extra_state_attributes(self)
None _log_callback(self, int level, str msg, **Any kwargs)
ScriptRunResult|None async_trigger(self, dict[str, Any] run_variables, Context|None context=None, bool skip_condition=False)
None _async_disable(self, bool stop_actions=DEFAULT_STOP_ACTIONS)
set[str] referenced_floors(self)
set[str] referenced_entities(self)
Callable[[], None]|None _async_attach_triggers(self, bool home_assistant_start)
None _async_enable_automation(self, Event event)
None async_turn_on(self, **Any kwargs)
ScriptRunResult|None _async_trigger_if_enabled(self, dict[str, Any] run_variables, Context|None context=None, bool skip_condition=False)
set[str] referenced_devices(self)
str|None referenced_blueprint(self)
set[str] referenced_labels(self)
None __init__(self, str|None automation_id, str name, list[ConfigType] trigger_config, IfAction|None cond_func, Script action_script, bool|None initial_state, ScriptVariables|None variables, ScriptVariables|None trigger_variables, ConfigType|None raw_config, ConfigType|None blueprint_inputs, ConfigType trace_config)
set[str] referenced_devices(self)
set[str] referenced_areas(self)
dict[str, Any]|None capability_attributes(self)
set[str] referenced_entities(self)
str|None referenced_blueprint(self)
set[str] referenced_floors(self)
ScriptRunResult|None async_trigger(self, dict[str, Any] run_variables, Context|None context=None, bool skip_condition=False)
set[str] referenced_labels(self)
bool __call__(self, Mapping[str, Any]|None variables=None)
set[str] referenced_labels(self)
None async_will_remove_from_hass(self)
None __init__(self, str|None automation_id, str name, ConfigType|None raw_config, str validation_error, ValidationStatus validation_status)
None async_added_to_hass(self)
set[str] referenced_floors(self)
str|None referenced_blueprint(self)
set[str] referenced_areas(self)
set[str] referenced_entities(self)
set[str] referenced_devices(self)
None async_trigger(self, dict[str, Any] run_variables, Context|None context=None, bool skip_condition=False)
None async_write_ha_state(self)
str|UndefinedType|None name(self)
None async_set_context(self, Context context)
State|None async_get_last_state(self)
blueprint.DomainBlueprints async_get_blueprints(HomeAssistant hass)
Generator[AutomationTrace] trace_automation(HomeAssistant hass, str|None automation_id, ConfigType|None config, ConfigType|None blueprint_inputs, Context context, ConfigType trace_config)
list[str] devices_in_automation(HomeAssistant hass, str entity_id)
list[str] automations_with_area(HomeAssistant hass, str area_id)
list[str] automations_with_label(HomeAssistant hass, str label_id)
bool is_on(HomeAssistant hass, str entity_id)
IfAction|None _async_process_if(HomeAssistant hass, str name, dict[str, Any] config)
None _async_process_config(HomeAssistant hass, dict[str, Any] config, EntityComponent[BaseAutomationEntity] component)
list[str] _trigger_extract_devices(dict trigger_conf)
list[str] _trigger_extract_entities(dict trigger_conf)
bool async_setup(HomeAssistant hass, ConfigType config)
str _automation_name(AutomationEntityConfig automation_config)
list[str] floors_in_automation(HomeAssistant hass, str entity_id)
list[str] automations_with_floor(HomeAssistant hass, str floor_id)
list[BaseAutomationEntity] _create_automation_entities(HomeAssistant hass, list[AutomationEntityConfig] automation_configs)
list[str] labels_in_automation(HomeAssistant hass, str entity_id)
list[str] automations_with_entity(HomeAssistant hass, str entity_id)
None _async_process_single_config(HomeAssistant hass, dict[str, Any] config, EntityComponent[BaseAutomationEntity] component, str automation_id)
list[str] entities_in_automation(HomeAssistant hass, str entity_id)
list[str] areas_in_automation(HomeAssistant hass, str entity_id)
None websocket_config(HomeAssistant hass, websocket_api.ActiveConnection connection, dict[str, Any] msg)
str|None blueprint_in_automation(HomeAssistant hass, str entity_id)
list[str] _x_in_automation(HomeAssistant hass, str entity_id, str property_name)
list[str] _automations_with_x(HomeAssistant hass, str referenced_id, str property_name)
list[str] automations_with_blueprint(HomeAssistant hass, str blueprint_path)
list[str] automations_with_device(HomeAssistant hass, str device_id)
bool _automation_matches_config(BaseAutomationEntity|None automation, AutomationEntityConfig|None config)
list[AutomationEntityConfig] _prepare_automation_config(HomeAssistant hass, ConfigType config, str|None wanted_automation_id)
datetime|None parse_datetime(str|None value)
CalendarEntity get_entity(HomeAssistant hass, str entity_id)
web.Response get(self, web.Request request, str config_key)
None async_stop(HomeAssistant hass)
None async_create_issue(HomeAssistant hass, str entry_id)
None async_delete_issue(HomeAssistant hass, str entry_id)
list[str] all_with_deprecated_constants(dict[str, Any] module_globals)
None async_register_admin_service(HomeAssistant hass, str domain, str service, Callable[[ServiceCall], Awaitable[None]|None] service_func, VolSchemaType schema=vol.Schema({}, extra=vol.PREVENT_EXTRA))
None script_execution_set(str reason, ServiceResponse response=None)
Generator[None] trace_path(str|list[str] suffix)
dict[str, deque[TraceElement]]|None trace_get(bool clear=True)
None trace_append_element(TraceElement trace_element, int|None maxlen=None)
CALLBACK_TYPE|None async_initialize_triggers(HomeAssistant hass, list[ConfigType] trigger_config, Callable action, str domain, str name, Callable log_cb, bool home_assistant_start=False, TemplateVarsType variables=None)
def valid_entity_id(hass)
def async_run(config_dir)