Get Automation Traces
ha_get_automation_tracesDebug automations and scripts by retrieving their execution traces, including trigger info, condition results, action steps, and errors.
Instructions
Retrieve execution traces for automations and scripts to debug issues.
Traces show what happened during automation/script runs:
What triggered the automation
Which conditions passed or failed
What actions were executed
Any errors that occurred
Variable values during execution
USAGE MODES:
List recent traces (omit run_id): ha_get_automation_traces("automation.motion_light") Returns a summary of recent execution runs with timestamps, triggers, and status. Use
offsetto page deeper whenhas_moreis true, ororder="oldest"to start from the earliest stored trace instead of the most recent.Get detailed trace (provide run_id): ha_get_automation_traces("automation.motion_light", run_id="1705312800.123456") Returns full execution details including trigger info, condition results, action trace with timing, and context variables.
Get detailed trace with logbook (provide run_id and detailed=True): ha_get_automation_traces("automation.motion_light", run_id="1705312800.123456", detailed=True) Returns the formatted trace plus logbook entries and context metadata. Useful when the standard trace summary doesn't reveal enough for debugging. Note: script-style action paths (sequence/, numeric) are always matched regardless of this flag.
Get full variables without deduplication (provide run_id and deduplicate=False): ha_get_automation_traces("automation.motion_light", run_id="1705312800.123456", deduplicate=False) Returns the formatted trace with full variables at every action step.
DEBUGGING EXAMPLES:
Automation not triggering:
Check if traces exist (automation may not be triggered)
Look at trigger info to see what event was received
Automation runs but conditions fail:
Get detailed trace to see condition_results
Each condition shows whether it passed (true) or failed (false)
Unexpected behavior in actions:
Get detailed trace to see action_trace
Shows each action step with result and any errors
For 'choose' actions, shows which branch was taken
Template debugging:
Detailed trace shows evaluated template values in context
Trigger variables available under trigger_variables
NOTES:
Traces are stored for a limited time by Home Assistant
Works for both automations and scripts (use full entity_id)
The 'state' field shows: 'stopped' (completed), 'running', or error state
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' (default) 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. Omit to list recent traces. | |
| detailed | No | Include extra diagnostic data: logbook entries and context metadata (default: False). Use when standard trace lacks detail for debugging. | |
| 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 (default: True). Set to False to include full variables at every step. | |
| 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 | |||