An automation that works 95% of the time is worse than none, because the other 5% teaches the household not to trust any of them. These are the lessons behind the automations that have survived here.

1. Automate what you'd forget, not what you enjoy

The best automations handle things nobody wants to think about: wet laundry, a porch light left on, a leak behind the washer. Automating things people like doing by hand, such as picking the music or setting the mood lighting for a film, usually just takes away the fun.

2. Manual always wins

If someone turns a light on by hand, an automation shouldn't turn it off thirty seconds later. Give the household an easy way to pause things, such as a "guest mode" or "party mode" toggle that the automations check:

conditions:
  - condition: state
    entity_id: input_boolean.party_mode
    state: "off"

3. Decide what happens when things fail

Ask what happens if Home Assistant restarts halfway through, a sensor runs out of battery, or the internet goes down. Delays and waits don't survive a restart, so a "turn off in 30 minutes" built with delay can leave a light on all night. For anything long, use a timer helper with restore enabled, or a trigger on a specific time. And make sure the safe state is the one the house falls back to: the leak valve closes and stays closed.

4. Debounce everything

Sensors flicker. Doors bounce. Power readings dip. Almost every state trigger is better with a short for:, so it fires on what's really happening rather than on noise:

triggers:
  - trigger: state
    entity_id: binary_sensor.back_door
    to: "on"
    for: "00:00:05"

5. Choose the right mode

6. Keep state in helpers

When an automation needs to remember something, like "a wash cycle is in progress" or "we're on holiday", put it in a helper such as a toggle, a date or a counter. Helpers show up on dashboards, survive restarts, and can be changed by hand when the automation gets it wrong. The laundry notifier is built around one.

7. Name, describe and label

"Porch: motion boost" beats "New automation 14". Write a one-line description saying why it exists, and use labels and categories to group related automations. Future you, at 11pm, trying to work out why the hallway light keeps turning on, will be grateful.

8. Read the traces

Every run of an automation leaves a trace showing which trigger fired, which conditions passed and what each step did. It's the fastest way to answer "why didn't that work?". Only the last five are kept by default, so for a troublesome automation, keep more:

- alias: "Porch: motion boost"
  trace:
    stored_traces: 20

9. Notify less

Every notification should be something someone can act on. "The washer's done" is useful. "Motion in the hallway" while you're home is noise, and noise trains people to ignore the alerts that matter. Save critical alerts that break through Do Not Disturb for real safety problems, like a water leak.

10. Prefer local devices

Devices that talk to Home Assistant directly over Zigbee, Z-Wave, Thread or Matter keep working when the internet doesn't, respond faster, and don't disappear when a company changes its cloud service. Cloud integrations are fine for things that are online by nature, like the weather or a calendar.

11. Use blueprints for repeated patterns

If you've written the same motion-light automation for five rooms, turn it into a blueprint and use it five times. Fixes then go in one place, and new rooms take a minute to set up.

12. Back up before you upgrade

Home Assistant ships a new release every month. Read the breaking changes section of the release notes, take a backup first, and keep a copy somewhere other than the machine Home Assistant runs on. Upgrading a few days after release, rather than on day one, avoids most surprises.