Automation

From Node-RED to Native HA YAML: A Migration Guide

Written with AI assistance by the editorial team.
Updated November 27, 2026 8 min read

Node-RED’s appeal for Home Assistant logic is visual: the flow is a diagram, with branches and triggers and gates laid out left-to-right. You can glance at a flow and understand what it does, in a way that is harder with a 200-line YAML automation file.

Native HA YAML automations have closed most of that gap. This post covers when a move makes sense, a migration plan, what is harder than expected, and the patterns that keep the YAML readable.

Why Node-RED, originally

Native automations used to be less expressive than they are now. The classic example: a multi-condition trigger like “person arrives home AND it’s after sunset AND the home mode is Away” was awkward to express in YAML — you’d write a trigger, then a conditions block, then in the action you’d need a separate template if any of the action steps depended on which trigger fired. In Node-RED, the same logic is three nodes connected by lines, and which trigger fired is self-evident from the flow.

For complex automations — a welcome-home flow, a morning briefing, a weather-alert escalation — Node-RED was genuinely easier to write and read. Once it is installed, more and more logic tends to move into it.

What changed

A few things, accumulating, make it worth reconsidering:

  1. HA’s automation engine got better. Trigger IDs made it possible to know which of multiple triggers fired without ambiguity. choose: and parallel: action blocks let you build branching logic in YAML that’s only slightly more verbose than Node-RED’s visual equivalent. Variables-from-triggers ({{ trigger.id }}, {{ trigger.event.data.X }}) made it possible to extract context cleanly.
  2. The Node-RED flow editor on a tablet is painful. The Node-RED editor really wants a desktop browser. Small changes become “wait until you’re at a desk” tasks, and they pile up.
  3. Version control is awkward. Node-RED stores flows as a single big flows.json. Editing it in a UI generates large, opaque diffs. A one-line logic change can show up as a very large diff because the editor reordered nodes. Native YAML automations diff cleanly — the change in YAML is the change in behavior.
  4. The dependency surface is bigger. Node-RED is an add-on container with its own runtime, its own update cadence, its own breakage modes. Add-on updates can break specific node types, and the usual fix is reverting the add-on. Native automations reduce the number of things that can break independently of HA itself.

The migration plan

A workable plan has three phases.

Phase 1: inventory and triage. Export flows.json, go through every flow, and put each one into one of three buckets:

  • Migrate — actively used logic that needs an HA equivalent
  • Drop — flows that were built and forgotten, or that have been replaced by something else without being cleaned up
  • Defer — flows that do something genuinely hard to replicate in YAML, which deserve more thought before migrating

Expect the “drop” bucket to be bigger than you think — flow rot is real.

Phase 2: mechanical migration. Work through the migrate list one flow at a time. Rewrite each one as a YAML automation, named to match the original flow, in the appropriate file under automations/. Disable the Node-RED flow but don’t delete it, so you can compare behavior.

Phase 3: comparison and cleanup. With the Node-RED flows disabled but still in place, exercise the automations — open doors, trigger presence, simulate weather conditions — and watch the YAML versions fire. Anywhere they don’t match the Node-RED behavior, fix the YAML. Once a flow is confirmed working, delete it from Node-RED. When the last flow is gone, uninstall the Node-RED add-on.

The patterns that keep YAML readable

Three patterns matter most:

Trigger IDs, always

Every trigger gets an id. Even if there’s only one trigger today. The reason is that adding a second trigger later is a much smaller change if the first one already has an ID — you don’t have to retroactively rewrite the action block to know which trigger fired.

triggers:
  - trigger: state
    entity_id: person.adult_one
    to: 'home'
    id: adult_one_home
  - trigger: state
    entity_id: person.adult_two
    to: 'home'
    id: adult_two_home

Then in the action: {{ trigger.id }} tells you which person triggered, and you can branch on it cleanly with choose:.

choose: blocks instead of nested templates

The temptation in YAML is to write a single action with a templated value that handles all cases:

# DON'T do this
actions:
  - action: notify.adult_one
    data:
      message: >
        {% if trigger.id == 'adult_one_home' %}Welcome home (person one)
        {% elif trigger.id == 'adult_two_home' %}Welcome home (person two)
        {% else %}Someone arrived
        {% endif %}

That works, but the logic gets opaque fast. choose: is more verbose but reads better:

actions:
  - choose:
      - conditions:
          - condition: trigger
            id: adult_one_home
        sequence:
          - action: notify.adult_one
            data:
              message: "Welcome home"
      - conditions:
          - condition: trigger
            id: adult_two_home
        sequence:
          - action: notify.adult_two
            data:
              message: "Welcome home"

Each case is self-contained. Easy to add a third person; easy to delete a case; easy to read three months later.

The single biggest readability win is splitting automations into package files by domain. For example, a packages/ directory might have:

  • solar.yaml — anything solar-related (sensors, automations, utility meters)
  • dashcam.yaml — dashcam ping sensors and notifications

A package can include sensor:, binary_sensor:, template:, automation:, script:, input_boolean: — anything HA understands. By keeping all the related logic in one file, you can read a feature top-to-bottom and understand it without bouncing between five files.

A flat automations/ directory can still be organized by category — security.yaml, presence.yaml, seasonal.yaml, system.yaml — with each automation in those files self-contained. Cross-feature logic that bridges domains lives in packages/.

What is harder than expected

A few things to watch for:

Trigger ordering with for:. Node-RED’s trigger nodes have explicit “fire only if state has been X for Y seconds” handling. HA’s for: on triggers does the same thing, but the combination with state changes during the wait is subtle. If you have trigger: state, to: 'on', for: 5 minutes, and the entity goes on → off → on within five minutes, what happens? The intent is that the trigger only fires after a continuous 5 minutes of on, but test this against your own entities to convince yourself rather than assuming.

Mode behavior. Node-RED flows are inherently parallel — every input message gets processed concurrently unless you explicitly serialize. HA automations default to mode: single: a second trigger while the first is still running does not start a new run and logs a warning (automation modes). For automations that relied on Node-RED’s parallel behavior (like a laundry-finished notification, where washer and dryer can finish within seconds of each other), switch to mode: queued or mode: parallel and verify the behavior is what you want.

Logbook noise. Native automations show up in the HA logbook whenever they trigger. Node-RED has its own debug log, separate from HA’s logbook, so after a migration the logbook can get busier. Mostly fine, but high-frequency triggers (state-sync automations and template sensors that re-evaluate often) can generate enough log entries that they are worth tuning down with conditions.

Two planning rules

Don’t do it in one weekend. A long burst leads to rushed decisions that have to be revisited later — automations that work, but are structured awkwardly. A migration spread over two or three weeks with a flow-per-day cadence produces cleaner output.

Migrate the simplest flows first to build confidence. The complex flows feel urgent, because they are the ones you most want out of Node-RED. Start with the simple ones anyway, to validate your migration patterns and the YAML idioms before tackling the hard cases. Otherwise the early hard cases get rewritten later, once better patterns have developed.

Where YAML is still worse

Two things:

Templating is awkward when it gets complex. A multi-line Jinja template with nested conditionals is harder to read than a Node-RED function node with the same logic in JavaScript. For the few automations where the template is doing real work (the unlock-by-name notification template from the Z-Wave lock post, for example), Node-RED would be more readable. It’s a real cost.

Loops are missing. HA actions don’t have a clean way to iterate over a list with a per-item action. There’s repeat: with for_each:, which works, but it’s verbose. Node-RED’s split node is much cleaner for any case involving a list.

These are minor relative to the gains. The version-control story alone — being able to look at a YAML file and see the actual logic, instead of a JSON blob — can be worth the migration.

Should you migrate?

If you’re starting fresh: skip Node-RED. HA’s native automations in 2026 are good enough that the visual flow editor isn’t worth the extra dependency.

If you have an existing Node-RED install that works: probably don’t migrate just because you read this post. Migrate if (a) you’re hitting one of the friction points above (mobile editing, version control, dependency surface), (b) you’re already restructuring your HA config and the migration fits naturally, or (c) one of the new YAML features (trigger IDs, choose: improvements, label-based selection) finally lets you express something cleanly that was awkward before.

If you’re migrating: spread it out. Use id on every trigger from the start. Lean on choose:. Keep related logic in package files. Verify each automation against its Node-RED equivalent before deleting the flow.


Related guides: Deploying HA config changes with git and Samba · Storage-mode to YAML dashboards · Presence detection that actually works

Tags #home-assistant #node-red #yaml #automation #migration
Share X / Twitter Facebook
Keep reading