You want to know why the hallway light came on at three in the morning, open the traces, and find only runs from the last twenty minutes. The default keeps just five.
Raise the limit per automation:
automation:
- alias: "Hallway motion light"
trace:
stored_traces: 20
triggers:
- trigger: state
entity_id: binary_sensor.hallway_motion
to: "on"
actions:
- action: light.turn_on
target:
entity_id: light.hallway
Reload automations and let it run a few times. The traces are on the automation’s page, where each run shows which trigger fired, how every condition turned out and what each action did.
For automations made in the editor, switch to YAML mode from the menu and add the trace block there.
I’d raise it for the handful of automations that misbehave or that fire constantly, such as motion lighting, and leave the rest at five. A number in the hundreds on a chatty automation is more history than anyone will read.
The limit counts runs, not days, so work it out from how often the thing triggers: an automation that fires twice an hour fills twenty slots in ten hours. For a question about last week, the history and the activity log serve better than traces. Once a trace has been pushed out, it’s gone, and changing the number won’t bring it back.
Further reading: Home Assistant automation YAML
Going deeper: Guide: Home Assistant backups in Docker, with a failure alert on your phone and a copy off the box