Run n8n on Raspberry Pi: Home Automation Just Got Smarter

Home automation is evolving fast, and so are the ways to manage it. If you’ve been looking for a way to automate tasks in your home using a flexible, low-cost platform, you’re going to love this. With just a Raspberry Pi and n8n—an open-source, powerful, low-code workflow automation tool—you can build your own smart home flows with ease. In this guide, you'll learn how to install n8n on Raspberry Pi step-by-step, along with some real-life automation examples that bring your smart home to life.

Whether you're new to home automation or just looking to level up, this tutorial will help you harness the full potential of n8n on your Raspberry Pi.

What Is n8n and Why Use It with Raspberry Pi?

If you've never heard of n8n (short for “nodemation”), it's a powerful, extendable workflow automation tool. Think of it like Zapier or Make.com, but open-source and infinitely customizable. Pairing it with a Raspberry Pi—a tiny, affordable computer—is a fantastic way to host automation workflows without paying for cloud servers.

Key Benefits of Running n8n on Raspberry Pi

  • Cost-effective: Raspberry Pi is inexpensive and energy-efficient.
  • Data privacy: Store and manage your automations locally.
  • Always-on automation: Perfect for 24/7 smart home control.
  • Extensibility: Integrate with smart devices, APIs, or sensors.

Prerequisites

Before we dive into how to install n8n on Raspberry Pi, ensure you have the following:

  • A Raspberry Pi 3 or 4 (Model 4 recommended for better performance)
  • Raspberry Pi OS (formerly Raspbian) installed and updated
  • Internet connectivity
  • Basic knowledge of using the terminal
  • Docker installed on your Raspberry Pi (we’ll cover this below if you haven’t done it yet)

Install n8n on Raspberry Pi: Step-by-Step Guide

There are multiple ways to install n8n, but we’ll keep it clean and efficient by running it via Docker on your Raspberry Pi.

💡 Why Docker?
Docker allows easy deployment, updates, and management of services like n8n while keeping your system clean.

Step 1: Update Your Raspberry Pi

Always begin by updating your packages:

sudo apt-get update && sudo apt-get upgrade -y

Step 2: Install Docker

If Docker isn't already installed, run:

curl -sSL https://get.docker.com | sh

After installation, add your user to the Docker group:

sudo usermod -aG docker $USER

You’ll need to restart or log out and back in for changes to apply.

Step 3: Create a Docker Volume for n8n

We’ll create a persistent volume so your workflows are saved even after a reboot.

docker volume create n8n_data

Step 4: Run n8n with Docker

Now let’s start n8n in the background:

docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -v n8n_data:/home/node/.n8n \
  -e N8N_BASIC_AUTH_ACTIVE=true \
  -e N8N_BASIC_AUTH_USER=admin \
  -e N8N_BASIC_AUTH_PASSWORD=yourpassword \
  n8nio/n8n

Change 'yourpassword' to something secure. This command:

  • Exposes n8n on port 5678
  • Enables basic login authentication
  • Uses our previously created volume for persistent storage

Your n8n instance is now up and running at:

http://<your-raspberry-pi-ip>:5678

Log in using the credentials you defined (admin/yourpassword).

Creating Your First Home Automation Workflow

Let’s walk through an example use-case once you install n8n on Raspberry Pi.

Example: Turn On a Smart Light When You Get an Email

Requirements: Smart light that supports webhook or API (e.g., Philips Hue with a local hub) and an email account with IMAP support.

Step-by-step Guide:

  1. Email Trigger Node

    • Use the “IMAP Email” trigger to monitor your inbox for a specific subject (e.g., "Home Alert").
  2. Filter Node (Optional)

    • Set conditions to match from a specific email or keyword.
  3. IFTTT Webhook or HTTP Request Node

    • Send a request to your smart bulb service to turn on the lights.
  4. Test Your Workflow

    • Send yourself a test email and see your light respond!

This is just one example of what’s possible. Want to automate turning off your Wi-Fi router at night or get a push notification when your laundry finishes? n8n can do that too.

How to Keep n8n Running in the Background

The container run we used earlier is temporary (it stops when the terminal closes). Let’s fix that.

Use Docker Compose for Persistent Setup

Create a new directory and add this file:

mkdir n8n-raspberry
cd n8n-raspberry
nano docker-compose.yml

Paste the following Docker Compose configuration:

version: "3"

services:
  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=yourpassword
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:

Save the file and run:

docker-compose up -d

Now, n8n will restart automatically even after rebooting your Raspberry Pi.

Useful Home Automation Ideas with n8n

Here are a few things you can build once you install n8n on Raspberry Pi:

  • Motion detection alerts using a motion sensor and Telegram API.
  • Daily to-do digest from Google Calendar sent directly to your phone.
  • Smart scheduling: Turn off devices or lights after certain hours.
  • Temperature monitoring: Use a DHT11/22 sensor with a webhook.
  • Voice assistant integration: Trigger workflows via Alexa or Google Assistant webhooks.

You can connect hundreds of services using built-in nodes, from Slack and Twitter, to smart home APIs and REST endpoints.

Suggested Table: Example Workflows

Purpose Trigger Type Smart Integration
Turn on lights after sunset Time-based Philips Hue API
Water plants at 6AM Schedule Smart irrigation system
Motion detected alert Hardware sensor Telegram Notification
Block social media at night Time + Workflow Router API / Firewall

Tips for Running n8n Smoothly on Raspberry Pi

  • Use a powered USB hub if connecting sensors or multiple devices.
  • Save backups of your workflows regularly.
  • Monitor performance with htop or enable logging in n8n.
  • Set up reverse proxy (e.g., with Nginx or Caddy) for HTTPS access.

FAQ

Can I install n8n on Raspberry Pi without Docker?

Yes, but Docker simplifies dependency management, updates, and port mapping. It’s the recommended method for beginners and advanced users alike.

Is Raspberry Pi 3 good enough to run n8n?

Yes, but performance is better on Raspberry Pi 4, especially if you're running multiple workflows or working with APIs frequently.

Can I access n8n from outside my home network?

Yes, but for security, you should set up HTTPS using a reverse proxy and expose it using platforms like Ngrok or DuckDNS with port forwarding.

How do I update n8n on Raspberry Pi?

If using Docker, it’s easy:

docker pull n8nio/n8n
docker-compose down
docker-compose up -d

What can I automate with n8n?

Anything from smart light actions, email alerts, weather-based automations, to syncing files between devices. If it has an API, you can integrate it into a flow.


With just a few setup steps, you can install n8n on Raspberry Pi and unlock powerful automation tools for your smart home and beyond. Whether you're triggering smart devices, managing schedules, or monitoring sensors, your home just got smarter—with open-source power at its core.

Comments
Join the Discussion and Share Your Opinion
Add a Comment

Leave a Reply

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