Tools

Home Assistant Automation YAML Generator

Build an automation as a form — trigger, conditions, actions, mode — and get the YAML back, ready to paste under the automations: key or drop into automations.yaml. The YAML is assembled in this page from your choices. Nothing is uploaded, and nothing is checked against your instance.

1. Name and behaviour

The alias is what you will see in the automation list. Mode decides what happens when a second trigger arrives while the first run is still going.

Pick classic keys for an older Home Assistant; pick modern keys (2024.10 or newer) for triggers:,conditions: and actions:.

Comment lines start with #. Home Assistant ignores them, so they are safe to keep or delete.

Start from an example

Zigbee plug power spike: Notify when a Zigbee smart plug reports more than 2000 W for five minutes — the shape of a heater or kettle left on a plug that was meant for a lamp. Plugs off at sunset when nobody is home: Sunset trigger, two conditions (nobody home, and the plug is drawing almost nothing) and two switch-off actions — the away-mode rule most Zigbee plug guides end with. Daily mesh health snapshot: A 03:00 time trigger, a shell command you define yourself, and a delay before the follow-up notification — the pattern behind long-term InfluxDB history.Every entity ID in these examples is a placeholder — rename all of them to the ones your own Home Assistant uses.

2. Triggers

Any one of these starts the automation. Add more than one and the YAML lists them together.

3. Conditions (optional)

A trigger says when, a condition says whether. With two or more conditions the generator nests them undercondition: and unless you ask for OR, because a flat list of conditions is read as OR by Home Assistant.

No conditions — this automation runs every time a trigger fires.

4. Actions

Actions run in the order you list them — the same order they appear here.

The YAML is built here in the browser — no request leaves the page.

What this generator does

Writing automation YAML by hand is mostly a memory test: which key holds the trigger platform, where a duration goes, whether a list of conditions means AND or OR. This page turns the decisions into a form and prints the YAML those decisions describe:

  • Builds the three blocks. Triggers, conditions and actions are added as rows and emitted in order, with the indentation Home Assistant expects.
  • Writes valid scalars. State names such as"on" and "off" are quoted, numbers stay numbers, and templates go into a block scalar instead of a quoted one-liner.
  • Nests conditions correctly. Two conditions with AND selected are wrapped in condition: and, because a bare list would be read as OR.
  • Says what it built. Every generated automation comes back with a plain-English summary and a note per field you chose, so you can catch a wrong entity before you save it.
  • Copies or downloads the result. Paste it intoautomations.yaml, or keep the file next to your backups.

How the blocks fit together

BlockAnswersKeys emitted
TriggerWhat should wake this automation uptrigger/platform plus entity_id, to, from, for, above, below, at, event, value_template
ConditionWhether it is allowed to run this timecondition plus entity_id, state, above, below, after, before, value_template
ActionWhat actually happens, in orderaction/service plus target.entity_id, data, delay, wait_template, timeout, stop

Triggers are OR-ed: any one of them fires the automation. Conditions are where the AND/OR choice lives, and actions are a queue — the next one starts when the previous one returns, unless you usemode: parallel.

Worked example

With the Zigbee plug preset loaded and everything else left at the defaults, the generator produces:

alias: Zigbee plug drawing too much power
description: Watches a Zigbee smart plug through a power sensor and warns when the load stays high.
mode: single
triggers:
  - trigger: numeric_state
    entity_id: sensor.living_room_plug_power
    above: 2000
    for:
      minutes: 5
conditions:
  - condition: state
    entity_id: person.owner
    state: home
actions:
  - action: notify.mobile_app_phone
    data:
      title: Plug overload
      message: The living room plug has been above 2000 W for five minutes.
  - action: switch.turn_off
    target:
      entity_id: switch.living_room_plug

In words: When sensor.living_room_plug_power goes above 2000 and stays there for 5 minutes — but only if person.owner is “home”, call notify.mobile_app_phone with 2 data fields, then call switch.turn_off on switch.living_room_plug. Thefor: block is what stops a one-second spike from firing the automation, and the notification action appears before the switch-off action because actions keep the order you gave them.

What the generator checks before it writes anything

  • The alias is filled in, so the automation has a name in Settings → Automations.
  • There is at least one trigger and at least one action — otherwise the automation could never fire or would do nothing.
  • Entity IDs look like domain.object_id in lower case; a value with spaces or capitals is flagged instead of being pasted in broken.
  • Numeric thresholds are numbers, and durations are whole seconds, minutes, hours or days.
  • Clock times are HH:MM or HH:MM:SS, and time patterns are a number, * or /N.
  • Service names look like domain.service, and mode: queued or parallel comes with a max.
  • Nothing here reaches your instance: entity IDs, services and thresholds still have to exist in your Home Assistant.

These are syntax and shape checks, not a validator for your home. Whether sensor.living_room_plug_power exists, and whether the service you named accepts the data you gave it, can only be answered by your own instance.

Limitations

  • Nothing is tested against a live instance. The page wrote YAML from your selections. Rename every placeholder entity ID, and reload the automation through Developer tools → YAML before you rely on it.
  • Modern keys need Home Assistant 2024.10 or newer.The classic option (trigger:, platform:,service:) is accepted by every release that reads YAML automations.
  • A limited trigger and action set. Seven trigger types, five condition types and four action types are covered — no device triggers, no blueprints, no choose: orrepeat: blocks. Nested logic is a hand edit away in a text editor.
  • No scripting beyond services. Named scripts, scenes and helpers are referenced by name and are not created for you.
  • Comments are plain text. When you ask for explanatory comments, they are added as # lines that Home Assistant ignores; they are a reading aid, not documentation that survives a UI edit.
  • Everything stays in the page. No upload, no storage, no analytics event carrying your entity IDs. Close the tab and the draft is gone.

FAQ

Is my automation uploaded anywhere?

No. The form is read by JavaScript in this page and the YAML is assembled in memory. There is no upload, no account and no request to any server, so your entity IDs and thresholds stay on your device. You can load the page, generate an automation, then disconnect from the internet and the result is identical.

Should I choose modern or classic YAML keys?

Modern keys write triggers, conditions and actions with a trigger key on each trigger and an action key with a target block. They need Home Assistant 2024.10 or newer. Classic keys (trigger, condition, action, platform and service) are accepted by every release that reads YAML automations, so pick classic if your instance is older or if you are following a tutorial written before 2024.

Why did it wrap my conditions in condition: and?

Because a plain list of conditions in Home Assistant is read as OR. When you have two or more conditions and AND is selected, the generator nests them under condition: and so the YAML says what you meant. Choose OR and the conditions stay flat, which is the same thing to Home Assistant and easier to read.

Will this YAML work with my entity IDs?

Only after you rename them. The generator writes exactly the entity IDs you typed and never contacts your instance, so it cannot know whether sensor.living_room_plug_power exists in your home. The examples are placeholders drawn from a Zigbee setup; copy real IDs from Developer tools → States, then reload the YAML through Developer tools → YAML before you rely on the automation.

Where do I put the generated YAML?

Either paste it under the automations: key of configuration.yaml, or add it to automations.yaml when you edit that file directly. If you use the automation editor in YAML mode, the entry can go in as a single list item. Check the configuration before restarting, and remember that a UI edit will rewrite comments the generator added.

Does it cover blueprints, choose blocks or device triggers?

No. It covers seven trigger types, five condition types and four action types — service calls, delays, wait_template and stop — which is the shape of most hand-written automations. Anything past that, such as choose, repeat, blueprints or device triggers, is a hand edit in a text editor afterwards.

Next step

The YAML only earns its keep once the entities behind it exist. The every-5-minutes automation examples cover the timing patterns this form builds, and the Zigbee network map visualizer shows which device IDs your mesh actually reports. If the automation watches a coordinator or a plug, the gateway guide and the channel overlap checker cover the radio side of the same setup.