Cross-check automation YAML against live HA
automations_validate_automation_referencesVerifies that entity IDs and services referenced in Home Assistant automation YAML exist in the live registry, ensuring valid references before saving.
Instructions
Cross-check entity IDs and services used in automation YAML against the live registry.
Unlike automations_validate_best_practices (static), this calls
ha.get_states() and ha.list_services() to verify that every literal
entity_id value and every literal service:/action: string in
yaml_content exists. It only looks at literal values — it does NOT
resolve device_id, area_id, label_id, or any templated reference,
not just the ones containing '{{ ... }}' (which are explicitly skipped
and counted in template_refs_skipped).
Use when: checking that an automation's references are real before
saving it with automations_set_automation_config.
Not for: YAML syntax or authoring-rule checks — use
automations_validate_best_practices.
Returns: dict {valid_yaml, automations_checked, entities_checked, services_checked, missing_entities[], missing_services[], template_refs_skipped, entities_check, services_check, errors[], summary}. entities_check/services_check are 'ok' or 'unavailable'.
Errors: returns {"valid_yaml": False, "error": "YAML parse error: ..."} for invalid YAML. When ha.get_states() or ha.list_services()
raises, the matching entities_check/services_check is 'unavailable'
and errors names which fetch failed; the corresponding missing_*
list stays empty rather than reporting a false "nothing missing" or a
false "everything is missing".
Limits: fetches the full live state list and full service list on
every call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| yaml_content | Yes | YAML text of a single automation dict or a list of automation dicts to check. Parsed with plain `yaml.safe_load`, so HA-only tags like '!input'/'!secret' are not resolved. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||