Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Home Automation & Smart Devices

Node-RED Tutorial: Visual Flow Programming for Home IoT India

Node-RED Tutorial: Visual Flow Programming for Home IoT India

March 11, 2026 /Posted byJayesh Jain / 0

Node-RED is a visual, browser-based flow programming tool that makes home IoT programming accessible without deep coding knowledge. Running on a Raspberry Pi or any Linux system, Node-RED connects ESP8266/ESP32 devices, MQTT brokers, databases, APIs, and home automation services with a simple drag-and-drop interface. This tutorial helps Indian makers set up and use Node-RED for their smart home IoT projects.

Table of Contents

  • What is Node-RED?
  • Installing Node-RED in India
  • Your First Flow
  • MQTT and ESP8266/ESP32 Integration
  • Building IoT Dashboards
  • India-Specific Automation Flows
  • Node-RED with Home Assistant
  • Frequently Asked Questions

What is Node-RED?

Node-RED is an open-source flow-based programming tool developed by IBM. It provides a visual editor where you connect “nodes” with wires to create automation flows. Each node represents a function (receive MQTT message, send email, process JSON, control a device). Connecting nodes creates a flow that executes when triggered.

Why Node-RED is popular with Indian IoT developers:

  • Visual programming: No deep coding required — drag, drop, and connect
  • Free and open-source: Runs on Raspberry Pi, VPS, or any Linux box
  • Huge node library: Pre-built nodes for MQTT, HTTP, email, Telegram, WhatsApp, Modbus, databases
  • Real-time dashboard: Node-RED Dashboard provides instant charts, gauges, and control panels
  • Integrates with Home Assistant, Alexa, Google Home

Installing Node-RED in India

# Install on Raspberry Pi (recommended for Indian homes - low power 24/7 server)
# First install Node.js:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs

# Install Node-RED globally:
sudo npm install -g --unsafe-perm node-red

# Start Node-RED:
node-red

# For autostart on boot:
sudo systemctl enable nodered.service

# Install script for Raspberry Pi (easiest):
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

# Access Node-RED UI at:
# http://raspberry-pi-ip:1880

# Install useful nodes:
cd ~/.node-red
npm install node-red-dashboard       # UI dashboard
npm install node-red-contrib-mqtt-sparkplug  # Advanced MQTT
npm install node-red-contrib-telegrambot    # Telegram notifications
npm install node-red-node-mysql      # MySQL database
Recommended: CH340G USB to TTL Converter for Raspberry Pi — Essential for serial debugging when setting up Node-RED on Raspberry Pi.

Your First Flow

Let’s create a simple flow: inject a timestamp every 5 seconds and log it:

  1. Open Node-RED at http://your-pi:1880
  2. Drag an inject node onto the canvas (from the left panel)
  3. Double-click the inject node → set Repeat: every 5 seconds
  4. Drag a debug node onto the canvas
  5. Connect the inject output to the debug input
  6. Click Deploy (top right)
  7. Open the debug panel (bug icon) — see timestamps every 5 seconds

Now let’s add a function node to format the timestamp for India (IST):

// Function node: Format timestamp for India
// Paste this in the Function node:
var d = new Date();
var istTime = new Date(d.getTime() + (5.5 * 60 * 60 * 1000));

var hours = istTime.getUTCHours();
var minutes = istTime.getUTCMinutes();
var seconds = istTime.getUTCSeconds();

msg.payload = "India Time: " + 
    String(hours).padStart(2,'0') + ":" + 
    String(minutes).padStart(2,'0') + ":" + 
    String(seconds).padStart(2,'0');
return msg;

MQTT and ESP8266/ESP32 Integration

// ESP8266/ESP32 MQTT code (publishes sensor data):
#include <PubSubClient.h>

// Publishes to topic: home/sensors/bedroom/temperature
// Node-RED subscribes to this topic and processes data

// Node-RED flow (JSON import):
[
    {
        "id": "mqtt-in-1",
        "type": "mqtt in",
        "topic": "home/sensors/+/temperature",  // + wildcard
        "broker": "mqtt-broker-1",
        "name": "Temperature Sensor Input"
    },
    {
        "id": "json-parse",
        "type": "json",
        "name": "Parse JSON"
    },
    {
        "id": "temp-check",
        "type": "function",
        "name": "Check Temperature",
        "func": "if (msg.payload.temp > 35) {
    msg.alert = 'High temperature alert: ' + msg.payload.temp + '°C';
}
return msg;"
    }
]

Building IoT Dashboards

// Node-RED Dashboard flow for temperature/humidity display
// Install: npm install node-red-dashboard

// Flow design:
// MQTT In (home/sensors/+/data) 
//   → JSON Parse
//   → Function (extract temp)
//   → Gauge node (Temperature gauge, 0-50°C)
//   → Chart node (Historical temperature chart)

// Gauge node configuration:
// - Group: Living Room
// - Label: Temperature
// - Range: 0 to 50
// - Colour stops: green (0-25), yellow (25-35), red (35-50)

// Dashboard available at: http://your-pi:1880/ui

// Example Function node for parsing ESP32 JSON payload:
// Input msg.payload: {"temp":28.5,"hum":65,"room":"bedroom"}
var data = msg.payload;
msg.topic = data.room;

// Create separate messages for each sensor:
node.send([
    {payload: data.temp, topic: "temperature"},
    {payload: data.hum, topic: "humidity"}
]);

India-Specific Automation Flows

Electricity Tariff-Aware AC Control

// Turn off AC during peak tariff hours (7PM-11PM on weekdays) to save on Indian electricity bills
// Triggered: every minute by inject node
// Function node:
var now = new Date();
var istHour = (now.getUTCHours() + 5) % 24;
var istMinute = (now.getUTCMinutes() + 30) % 60;
// IST hour approximation

var isPeakHour = (istHour >= 19 && istHour  0 && now.getDay() < 6;

if (isPeakHour && isWeekday) {
    // Raise AC temperature to 26°C to reduce consumption
    msg.payload = '{"temperature": 26}';
    msg.topic = "cmnd/bedroom_ac/climate";
    return msg;
}

Power Cut Recovery

// Subscribe to MQTT topic that ESP32 publishes on startup
// This fires when any ESP device reboots (power cut recovery)
// MQTT topic: home/device/+/startup

[MQTT In] → [Function: Restore device state from context] → [MQTT Out]

// Function node:
var deviceId = msg.topic.split('/')[2];
var savedState = context.global.get(deviceId) || 'off';
msg.payload = savedState;
msg.topic = 'cmnd/' + deviceId + '/POWER';
return msg;
Recommended: Mega WiFi R3 with NodeMCU ESP8266 — Ideal multi-sensor platform publishing MQTT data that Node-RED flows can process and visualise.

Node-RED with Home Assistant

# Install node-red-contrib-home-assistant-websocket node:
cd ~/.node-red
npm install node-red-contrib-home-assistant-websocket

# Configure HA server in Node-RED:
# - Server: http://homeassistant.local:8123
# - Access Token: (long-lived access token from HA profile)

# Example flow: Call HA service from Node-RED
// Inject → Function → Call Service node

// Call Service node config:
// Domain: light
// Service: turn_on
// Entity ID: light.living_room

// Function node to build service data:
msg.payload = {
    entity_id: "light.living_room",
    brightness_pct: 75
};
return msg;

# Trigger HA automation from Node-RED:
// POST to HA webhook: http://homeassistant.local:8123/api/webhook/my_webhook_id

Frequently Asked Questions

Is Node-RED better than Home Assistant for Indian smart homes?

They serve different purposes. Home Assistant is a complete smart home platform with device management, mobile app, and hundreds of integrations. Node-RED is a flow programming tool for custom automation logic. Many Indian makers use both — Home Assistant for device management and Node-RED for complex automation flows that HA’s built-in automation editor can’t handle easily.

Can Node-RED run on a cheap VPS server in India?

Yes — Node-RED is lightweight and runs on even a ₹400/month VPS from Indian providers like DigitalOcean Bangalore, AWS Mumbai, or GCP Mumbai region. This gives you cloud-based automation accessible from anywhere, though it introduces cloud dependency unlike a local Raspberry Pi setup.

How do I back up my Node-RED flows in India?

Node-RED stores flows in ~/.node-red/flows.json. Back up this file regularly. For version control, commit it to a private Git repository. Node-RED also has a built-in export function (hamburger menu → Export) to download flows as JSON that can be imported on another instance.

What is the difference between Node-RED and MQTT?

MQTT is a messaging protocol — devices publish and subscribe to topics. Node-RED is a processing platform — it subscribes to MQTT topics, processes the messages (using JavaScript function nodes), and publishes results or triggers actions. Node-RED uses MQTT as one of many input/output channels.

Can Node-RED send WhatsApp messages for Indian home automation alerts?

Node-RED can send WhatsApp messages via the WhatsApp Business API (paid) or unofficial API wrappers. More practically, Telegram notifications are free and commonly used by Indian Node-RED users — the node-red-contrib-telegrambot node is well-maintained and popular.

Shop Home Automation at Zbotic →

Tags: iot india, MQTT dashboard, Node-RED, raspberry pi iot, visual programming
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
VESC vs KT Controller for High...
blog vesc vs kt controller for high performance e bike india 598818
blog electric cargo bike build heavy duty motor and frame india 598826
Electric Cargo Bike Build: Hea...

Related posts

Svg%3E
Read more

MQTT for Home Automation: ESP32 + Mosquitto + Home Assistant

April 1, 2026 0
MQTT is the backbone protocol of professional home automation systems. If you are building a smart home with multiple ESP32... Continue reading
Svg%3E
Read more

Curtain and Blind Automation: Stepper Motor Controller

April 1, 2026 0
Curtain automation is one of the most satisfying smart home upgrades you can build. Imagine your curtains opening automatically at... Continue reading
Svg%3E
Read more

Smart Doorbell with Camera: ESP32-CAM Video Intercom

April 1, 2026 0
A smart doorbell with a camera lets you see who is at your door from your phone, even when you... Continue reading
Svg%3E
Read more

Blynk IoT Platform: Control Arduino and ESP32 from Mobile

April 1, 2026 0
The Blynk IoT platform is the fastest way to control your Arduino and ESP32 projects from your mobile phone. Instead... Continue reading
Svg%3E
Read more

PIR Sensor Automatic Light: Save Electricity with Motion Detection

April 1, 2026 0
PIR sensor automatic lights are the simplest and most effective way to save electricity in Indian homes. By automatically turning... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now