brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: keep more than five Home Assistant automation traces with stored_traces

Home Assistant
~/tips/tip-ha-stored-traces

automation:

Lets you inspect older runs of an automation that fires often.

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

More Home Assistant tips Trust X-Forwarded-For: on Unlimited login attempts: off sequence: template: enabled: false All Home Assistant tips (11) All topics

Link