Get Automation Traces
ha_get_automation_tracesRetrieve execution traces for Home Assistant automations and scripts to debug failures, inspect triggers, condition results, actions, errors, and runtime variables.
Instructions
Get execution traces for automations and scripts to debug issues.
Traces show what triggered a run, which conditions passed or failed, which actions executed (for 'choose', which branch was taken), any errors, and variable values during execution. Home Assistant keeps only the most recent runs of each automation or script (its stored_traces setting), so older runs are not available. The 'state' field shows 'stopped' (completed), 'running', or an error state.
USAGE MODES:
List recent traces (omit run_id): returns a summary of recent runs with timestamps, triggers, and status. Use
offsetto page deeper whenhas_moreis true. ha_get_automation_traces("automation.motion_light")Get a detailed trace (provide run_id): full execution details including trigger info, condition results, action trace with timing, and context variables. ha_get_automation_traces("automation.motion_light", run_id="1705312800.123456")
Add logbook entries and context metadata: detailed=True. Script-style action paths (sequence/, numeric) are always matched regardless of this flag.
Variables at every step (trigger sets and null entries are still omitted): deduplicate=False.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of traces to return when listing (default: 10, max: 50). | |
| order | No | Order traces are returned in. 'newest' returns most-recent first; 'oldest' returns chronological-first. | newest |
| offset | No | Number of traces to skip from the start of the requested order. Use with `limit` to page through stored traces when `total_available > limit`. | |
| run_id | No | Specific trace run_id to retrieve detailed trace. | |
| detailed | No | Include extra diagnostic data: logbook entries and context metadata. | |
| sections | No | Comma-separated list of trace sections to return. Valid values: trigger, conditions, actions, config, error, logbook, context. Omit to return all sections. Example: 'actions' or 'trigger,conditions'. | |
| deduplicate | No | Deduplicate variables across action steps. Set to False to record the variables at every step; steps whose variables carry 'trigger', and null-valued entries, are omitted either way. | |
| automation_id | Yes | Automation or script entity_id (e.g., 'automation.motion_light' or 'script.morning_routine') |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||