Node-RED vs Home Assistant Automations — When to Use Which

📅 April 2026⏱️ 7 min read🏷️ Home Assistant · Node-RED

One of the most common questions from intermediate HA users is: when do I use Node-RED instead of HA's built-in automations? The short answer is that HA automations are excellent for 80% of use cases, and Node-RED is invaluable for the other 20% — but it's important to know which is which before you start building.

The rule of thumb

If your automation fits neatly into "when X happens, if Y is true, do Z" — use HA automations. They're simpler, live in the config files, and are easy to debug in the UI. When your logic involves loops, CSV file writing, API calls with retry logic, complex multi-step decision trees, or stateful counters — use Node-RED.

What HA Automations Do Well

For a home with 10–20 automations doing sensible things like "turn off lights when no motion" or "arm alarm when everyone leaves" — HA automations are perfect. The UI editor is good, the YAML is readable, and there's no extra addon to manage.

Where Node-RED Wins

1. CSV File Logging

HA has no native file-writing capability. If you want to log sensor data to CSV for later analysis — solar production, biltong box humidity, energy consumption by circuit — you need Node-RED. The fs node in Node-RED handles file reads and writes cleanly.

A real example: a 78-column solar diagnostic logger running on a SolaX X1-Hybrid system captures PV power per string, battery SOC, charge rate, grid power, inverter mode, outdoor temperature, and a dozen calculated values — every 60 seconds — to two files (master permanent log + session buffer for API calls).

2. External API Calls with Logic

Making an API call in HA automation is possible but awkward. In Node-RED, the HTTP request node handles it cleanly, and you can wire the response directly into decision logic. A production flow uses the Claude API to evaluate current solar conditions and recommend an AC mode — the API response feeds directly into climate service calls with fallback logic if the API is unavailable.

3. Complex Multi-Step Sequences with Delays

Sequential irrigation is a good example. Zone 1 runs for 12 minutes, then Zone 2 for 15 minutes, then Zone 3 for 8 minutes. In HA automations, this requires a script with nested delays and is hard to modify. In Node-RED, it's a linear flow with delay nodes between zone on/off service calls — visually obvious, trivially editable.

4. Stateful Flows with Running Counters

Node-RED has persistent flow context (flow.set/flow.get) that survives between messages. This is ideal for drying phase detection: tracking peak absolute humidity delta, elapsed hours, batch ID, and phase transitions across dozens of sensor readings per hour.

5. Error Handling and Retry Logic

HA automations fail silently when a service call errors. Node-RED lets you wire catch nodes that detect failures and implement retry logic, send notifications, or fall back to a safe state. For API-dependent automations (like the Claude AC controller), this is critical.

Setting Up Node-RED in HA

  1. Install from addon store: Settings → Add-ons → Node-RED (Community)
  2. Configure credentials: Set a username and password in the addon configuration before first start
  3. Install HA nodes: In Node-RED → Manage palette → search "node-red-contrib-home-assistant-websocket" — this gives you native HA entity nodes
  4. Connect to HA: Drag a "server config" node, set URL to http://supervisor/core, token to a Long-Lived Access Token from your HA profile

The fs Module — File Writing in Node-RED

By default, Node-RED sandboxes function nodes and blocks require(). To enable file system access:

  1. Create a new flow tab called "Setup"
  2. Add a single inject node (fires once on deploy) → function node
  3. In the function node: global.set('fs', require('fs'));
  4. In any other function node: const fs = global.get('fs');

Files written to /homeassistant/www/ are accessible via HA's media browser at http://your-ha-ip:8123/local/filename.csv

Real Flow: Biltong Box Monitor

This flow runs every 5 minutes during an active batch. It reads inside and outside humidity and temperature sensors, calculates the absolute humidity delta (the key drying metric), determines the current drying phase, and appends a row to a batch-specific CSV file. When the delta starts declining significantly, it sends a push notification that the batch is entering the "Near Done" phase.

The absolute humidity calculation (converting relative humidity + temperature to grams of water per cubic metre of air) is essential — relative humidity alone is meaningless without temperature, since warm air can hold much more moisture than cool air. A 70% RH reading at 30°C represents far more water vapour than 70% at 15°C.

See the actual Node-RED flow code

The complete biltong box flow, solar AC controller, irrigation controller and solar CSV logger are in our Home Assistant Planner — with importable code and architecture diagrams.

🔴 View Node-RED Flows