A hallway light that comes on automatically at sunset is a modest beginning. A home where lights, climate controls, motion sensors, and security monitors work seamlessly across Apple, Android, and local hardware without cloud subscriptions is where home automation becomes genuinely valuable. Home Assistant is the premier open-source smart home platform, putting private, local control at the center of your household.

Running Home Assistant on a Raspberry Pi gives you a dedicated, energy-efficient, always-on hub that stays inside your local network. This guide walks you through hardware selection, choosing between Home Assistant OS and Docker Container, initial onboarding, integrating Zigbee and Matter, building your first reliable automation, and establishing a secure backup and remote access workflow.

Hardware planning and storage reliability

Home Assistant runs continuous SQLite or PostgreSQL database operations, logging state changes every time a sensor detects movement or a thermometer reports temperature. Choosing appropriate hardware prevents performance bottlenecks and storage corruption down the line.

  • Raspberry Pi Model: A Raspberry Pi 5 or Raspberry Pi 4 with 4 GB or 8 GB of RAM is strongly recommended. A 64-bit operating system is required. While Home Assistant can boot on 2 GB boards, memory pressure quickly builds once you enable multiple integrations, dashboard cameras, and add-ons.
  • Storage Strategy: Do not use standard entry-level microSD cards for long-term home automation. Frequent database write cycles will wear out budget flash memory within months. Instead, use an A2-rated high-endurance microSD card, or even better, an external USB 3.0 SSD or NVMe base hat. Solid-state drives deliver near-instant dashboard responsiveness and superior write endurance.
  • Dedicated Power Supply: Voltage dips corrupt storage during write operations. Use the official Raspberry Pi 27W USB-C power supply for Pi 5, or the official 15W supply for Pi 4.
  • Network Connection: Connect your Raspberry Pi directly to your primary router or network switch via gigabit Ethernet. Do not rely on Wi-Fi for an automation server controlling primary household infrastructure.
  • Zigbee and Matter Radio Dongle: If you plan to connect Zigbee or Thread sensors (such as Sonoff, Aqara, or Philips Hue bulbs), purchase a dedicated USB coordinator like the Home Assistant SkyConnect, Sonoff Zigbee 3.0 USB Dongle Plus, or ConBee II. Always plug USB dongles into a short USB 2.0 extension cable rather than directly into the Pi chassis; USB 3.0 ports emit radio frequency noise that interferes with 2.4 GHz Zigbee and Thread signals.

Architecture decision: Home Assistant OS vs Docker Container

Before writing software to your drive, decide which architectural deployment matches your technical preferences:

Feature Home Assistant OS (HAOS) Home Assistant Container (Docker)
Target Audience Turnkey smart home hub, minimal Linux maintenance Homelabbers running multiple projects on Raspberry Pi OS
Supervisor & Add-on Store Built-in (one-click add-ons for Samba, Mosquitto, VS Code) Not included (services managed via Docker Compose)
Host OS Access Stripped-down Buildroot appliance; no apt or systemd Full standard Raspberry Pi OS / Debian access
Updates & Snapshots Native visual one-click updates and full OS snapshots Managed via Docker image tags and manual backup scripts
Host Resource Sharing Dedicated strictly to Home Assistant Shared with Open Pi, Pi-hole, Jellyfin, and other containers

For most dedicated smart home installations, Home Assistant OS is the official recommendation. If you plan to use this Raspberry Pi as a general-purpose home server running alongside Open Pi and other Docker services, choose Docker Container. Both methods are detailed below.

Method 1: Install Home Assistant OS

Home Assistant OS replaces the operating system on your target drive, turning your Raspberry Pi into a dedicated appliance.

  1. Download and install Raspberry Pi Imager on your computer.
  2. Connect your microSD card or USB SSD to your computer.
  3. In Raspberry Pi Imager, select your Raspberry Pi board model (Raspberry Pi 5 or Raspberry Pi 4).
  4. Under Operating System, select Other specific-purpose OS -> Home assistants and home automation -> Home Assistant OS.
  5. Select your target storage drive. Verify that you have selected the correct disk, as all existing partitions will be erased.
  6. Click Next and confirm the write. Allow the imager to complete both the flashing and verification processes.
  7. Insert the drive into your Raspberry Pi, attach the Ethernet cable, and connect power.

During first boot, Home Assistant OS automatically formats internal partitions, downloads the latest container images, and initializes its local database. This process takes 10 to 15 minutes depending on your storage write speed and internet bandwidth.

Verify network connectivity from another computer on the same local subnet:

BASH
ping -c 3 homeassistant.local

Once reachable, open your web browser and navigate to http://homeassistant.local:8123. If your local router does not support mDNS name resolution, look up the assigned IP address in your router dashboard or mobile network scanner and navigate to http://<YOUR_PI_IP>:8123.

Method 2: Deploy Home Assistant Container with Docker Compose

If you are already running Raspberry Pi OS and want Home Assistant to run alongside your other containers:

Create a dedicated directory structure for Home Assistant configuration files:

BASH
mkdir -p "$HOME/homeassistant/config"
cd "$HOME/homeassistant"

Create a compose.yaml file in this directory:

YAML
services:
  homeassistant:
    container_name: homeassistant
    image: ghcr.io/home-assistant/home-assistant:stable
    privileged: true
    restart: unless-stopped
    network_mode: host
    environment:
      - TZ=UTC
    volumes:
      - ./config:/config
      - /run/dbus:/run/dbus:ro

Using network_mode: host is essential. It enables Home Assistant to receive mDNS discovery broadcasts from smart TVs, Philips Hue bridges, ESPHome microcontrollers, and Google Cast devices across your local network. Replace TZ=UTC with your local timezone identifier (for example, America/New_York or Europe/London).

Launch the container in the background:

BASH
docker compose up -d
docker compose logs -f

Follow the logs until the engine completes its database migrations. You can then open http://<YOUR_PI_IP>:8123 in your browser.

Complete onboarding and initial configuration

When you first open the web interface at port 8123, Home Assistant presents the initial onboarding wizard:

  1. Create Owner Account: Set a strong primary administrator username and password. This account holds root administrative privileges over integrations, dashboards, and hardware settings.
  2. Name Your Home & Pin Location: Enter a recognizable name for your home and drag the pin to your physical residence on the world map. This location data remains strictly local on your Pi. Home Assistant calculates solar elevation, azimuth, and local dawn/dusk times from these coordinates, which are essential for daylight-triggered automations.
  3. Configure Time Zone and Elevation: Confirm your local time zone and units of measurement (Celsius/Fahrenheit, Metric/Imperial).
  4. Privacy and Telemetry: Choose whether to share anonymized diagnostic statistics with the open-source Home Assistant core team.

Click Finish. Home Assistant immediately scans your subnet and displays all automatically detected smart devices.

Device discovery, Zigbee, and area organization

Clean device organization is what separates an enjoyable smart home from an unmaintainable tangle of entities.

Local network discovery

Home Assistant automatically detects compatible devices on your Wi-Fi and Ethernet network, including smart speakers, media players, network storage, and smart lighting hubs. For each discovered device, click Configure in Settings -> Devices & services, follow the on-screen pairing prompt, and assign each device to a physical room.

Zigbee Home Automation (ZHA)

If you connected a USB Zigbee adapter: 1. Navigate to Settings -> Devices & services -> Add Integration. 2. Search for Zigbee Home Automation (ZHA) and select your USB serial port (for example, /dev/ttyUSB0 or /dev/ttyACM0). 3. Set your radio type (EZSP for SkyConnect/Sonoff-E, or Z-Stack for Sonoff-P). 4. Put your smart bulb or sensor into pairing mode, click Add Zigbee Device, and wait for the handshake to complete.

Structuring areas and naming conventions

Avoid leaving devices with arbitrary factory IDs like light.bulb_b4e62d_level. Navigate to Settings -> Areas & zones -> Areas, create rooms representing your floor plan (Living Room, Kitchen, Office, Hallway), and assign entities using a consistent pattern:

[Domain].[Area]_[Descriptor] (for example: light.living_room_ceiling, binary_sensor.front_door_contact).

Build your first reliable automation

Automations in Home Assistant follow a Trigger-Condition-Action pattern: - Triggers: Events that kick off the evaluation (for example, sunset, motion detected, time of day). - Conditions: Optional filters that must evaluate to true (for example, somebody is home, ambient light is low). - Actions: Tasks to perform (for example, turn on lights, send a mobile notification).

In Settings -> Automations & scenes, create a new automation. Switch to YAML mode by clicking the three dots in the top-right corner, and paste this adaptive sunset lighting sequence:

YAML
alias: Living room adaptive sunset lights
description: Turn on accent lights when the sun sets, but only if someone is home.
triggers:
  - trigger: sun
    event: sunset
    offset: "-00:30:00"
conditions:
  - condition: zone
    entity_id: device_tracker.primary_phone
    zone: zone.home
actions:
  - action: light.turn_on
    target:
      area_id: living_room
    data:
      brightness_pct: 70
      transition: 5
mode: single

Testing and visual trace debugging

Never wait until sunset to discover that an automation has a syntax error. Home Assistant includes a built-in debugging engine: 1. In the automation editor, click Run Actions. This immediately executes the action block, verifying that target entity IDs exist and respond. 2. Click Traces in the top navigation bar. Home Assistant displays a visual execution graph showing step-by-step logic, condition evaluation results, and the exact timestamps of every state change. If an automation fails to trigger, the trace highlights the exact condition that halted execution.

Essential add-ons and backup strategy

If you are running Home Assistant OS, navigate to Settings -> Add-ons and install these fundamental services: - Samba Share: Exposes your /config/ directory over local Windows/macOS file sharing for easy configuration editing. - Studio Code Server: Provides a full Visual Studio Code IDE with Home Assistant YAML autocompletion directly inside your web browser. - Mosquitto Broker: Installs a local MQTT message broker for custom DIY sensors and ESPHome microcontrollers. - Tailscale: Creates a secure, private encrypted mesh network between your devices without opening router ports.

The 3-2-1 backup strategy

A smart home with months of historical sensor logs and custom automation rules must be protected against drive failure: 1. In Settings -> System -> Backups, click Create Backup. Select Full backup and protect it with a password. 2. Once created, click the backup entry and select Download backup to save the archive on your main PC or NAS. 3. Set up an automated offloading mechanism using the Google Drive Backup or Network Storage (Samba/NFS) integration under Settings -> System -> Storage. Storing backups exclusively on the local microSD card offers zero protection if that storage drive fails.

Secure remote access without port forwarding

You will frequently want to check temperatures, adjust climate controls, or receive door alerts when away from home. However:

Never forward port 8123 directly to the public internet on your home router. Exposing an unencrypted, direct port to your smart home controller invites brute-force credential stuffing and potential automated vulnerability scanning.

Choose one of these three secure alternatives: 1. Home Assistant Cloud (Nabu Casa): The official encrypted relay managed by the Home Assistant founders. It requires zero router configuration, supports end-to-end encrypted remote connections, and integrates directly with Google Assistant and Amazon Alexa. 2. Tailscale Mesh VPN: Install the Tailscale integration on Home Assistant and on your mobile phone. You connect to your private smart home IP from anywhere in the world without exposing any ports on your home firewall. 3. Nginx Reverse Proxy with Cloudflare SSL: If you manage your own domain, route incoming traffic through an SSL reverse proxy with Let's Encrypt certificates, WebSocket support, and rate limiting.

Monitor Home Assistant with Open Pi

Home Assistant is an infrastructure service. When an automation seems sluggish or smart devices stop responding, knowing whether your Raspberry Pi is suffering from CPU thermal throttling or out-of-memory swapping is invaluable.

With the Open Pi mobile app on iOS or Android: - Real-time Metrics: Monitor CPU core temperatures, system load averages, RAM allocation, and disk write activity in real time. - Thermal Throttling Detection: Verify that your Raspberry Pi 4 or 5 is not throttling clock frequencies during intensive automation tasks or camera streaming. - Docker Container Inspection: When running Home Assistant Container, inspect container status, CPU percentages, and restart logs directly from your phone without opening a desktop terminal.

Practical troubleshooting checklist

When an entity drops offline or the dashboard becomes unresponsive, consult this diagnostic checklist:

  • Cannot Reach homeassistant.local: If your workstation cannot resolve the mDNS hostname, run ip -4 addr show on the Pi or check your router's DHCP leases. Access the web interface using the static IP address: http://192.168.x.x:8123.
  • Zigbee Devices Randomly Dropping: Almost always caused by 2.4 GHz radio frequency interference from USB 3.0 ports or overlapping Wi-Fi channels. Move your Zigbee USB dongle to a 1-meter USB 2.0 extension cable, and configure your 2.4 GHz Wi-Fi to use channel 1 or 6 while setting your Zigbee network to channel 25.
  • Database File Bloating: Over months, recording every minor sensor flutter can expand your home-assistant_v2.db file to tens of gigabytes. Configure recorder in your configuration.yaml to purge old data automatically:
YAML
recorder:
  purge_keep_days: 10
  commit_interval: 10
  exclude:
    domains:
      - updater
    entity_globs:
      - sensor.load_*

Sources and further reading

Open Pi logo
Monitor your Raspberry Pi from your phone

Check real-time CPU, RAM, temperature, and service health for your smart home projects with Open Pi for iOS and Android. Local-first, private, and no cloud account required.

Explore Open Pi App StoreGoogle Play
About this guide

Researched and validated against official project documentation and community standards on September 11, 2026. Review your board model, storage, and current release notes before deploying.