A Raspberry Pi running Home Assistant OS turns a $60-$120 board into a local-first smart home hub that controls lights, sensors, and switches without cloud dependence. The setup takes about 30 minutes, but hardware choices (storage, power supply, radio dongles) decide whether the system runs for years or corrupts its SD card in six months. This guide covers the full path: hardware selection, flashing, first boot, integrations, and the practices that keep the hub stable.
Quick Takeaways
- Best hardware: Raspberry Pi 5 (4GB) or Pi 4 (4GB) with an NVMe/USB SSD, not an SD card.
- Best install method: Home Assistant OS (HAOS) gives you Add-ons, Supervisor, and one-click backups.
- Power matters: Use the official 5V/5A USB-C supply for the Pi 5 and 5V/3A for the Pi 4.
- Radios: Use a USB extension cable and a dedicated Zigbee/Z-Wave coordinator to avoid 2.4GHz interference.
| Spec | Raspberry Pi 4 (4GB) | Raspberry Pi 5 (4GB) |
|---|---|---|
| CPU | Cortex-A72, 1.8GHz | Cortex-A76, 2.4GHz |
| Power Supply | 5V/3A | 5V/5A (27W) |
| Boot Storage | SD / USB SSD | SD / USB SSD / NVMe (via HAT) |
| Idle Power | ~3W | ~3-4W |
| Best For | Under 100 entities | 200+ entities, cameras, voice |
| Approx. Cost | Low | Moderate |
Choosing Your Home Assistant Installation Method
Home Assistant offers four installation types. Only two suit most Raspberry Pi owners.
| Method | Add-ons | Supervisor | Difficulty | Recommended? |
|---|---|---|---|---|
| Home Assistant OS | Yes | Yes | Easy | Yes |
| Supervised | Yes | Yes | Hard | No (Debian-dependent) |
| Container (Docker) | No | No | Medium | For advanced users |
| Core (Python venv) | No | No | Hard | Not recommended |
Pick Home Assistant OS unless you must share the Pi with other services. HAOS manages updates, backups, and Add-ons (Mosquitto, ESPHome, Zigbee2MQTT) from one interface.
Hardware Requirements and Bill of Materials
Core Components
- Raspberry Pi 4 or 5, 4GB RAM. The 2GB model works but leaves little headroom for add-ons.
- Power supply: Official 5V/5A (Pi 5) or 5V/3A (Pi 4). Undervoltage causes random reboots and file system damage.
- Storage: A 120GB+ SSD over USB 3.0, or an M.2 NVMe drive on a Pi 5 HAT. Avoid cheap SD cards for long-term use.
- Ethernet cable: Wired Gigabit Ethernet is more reliable than Wi-Fi.
- Case with cooling: An active or passive heatsink case keeps the SoC under 70°C, avoiding thermal throttling.
Optional Radios
- Zigbee coordinator: Home Assistant SkyConnect/Connect ZBT-1, or a Sonoff Zigbee 3.0 Dongle Plus (CC2652P or EFR32MG21).
- Z-Wave stick: Zooz 800 Series or Aeotec Z-Stick 7.
- USB 2.0 extension cable (1m+): Moves the dongle away from USB 3.0 noise, which radiates in the 2.4GHz band.
Why SD Cards Fail
Home Assistant writes to its database (SQLite by default) constantly. Consumer SD cards have limited write endurance and degrade under that load. An SSD offers higher IOPS and far greater endurance, and it makes boot and restore times noticeably faster.
Step-by-Step: Install Home Assistant OS on Raspberry Pi
Step 1: Flash the Image
- Download Raspberry Pi Imager from raspberrypi.com on your PC.
- Click Choose Device and select your Pi model.
- Click Choose OS → Other specific-purpose OS → Home assistants and home automation → Home Assistant → select the image for your board.
- Click Choose Storage and select your SSD or SD card.
- Click Write.
Step 2: Configure Boot Order (SSD Users)
For USB boot on a Pi 4, update the EEPROM bootloader first using Raspberry Pi Imager (Misc utility images → Bootloader → USB Boot). The Pi 5 boots from USB by default in most configurations. For NVMe on a Pi 5, set the boot order in the EEPROM:
# Run on Raspberry Pi OS before switching to HAOS
sudo rpi-eeprom-config --edit
# Set boot order: try NVMe (6), then USB (4), then SD (1)
BOOT_ORDER=0xf146
# Pi 5 only: enable PCIe Gen 3 for faster NVMe throughput (optional)
PCIE_PROBE=1
Save, reboot, and verify with vcgencmd bootloader_config.
Step 3: First Boot
- Connect Ethernet, the SSD, and power.
- Wait 5 to 20 minutes. HAOS downloads the latest Home Assistant Core on first boot.
- Open
http://homeassistant.local:8123in a browser. If mDNS fails, find the Pi’s IP address in your router and usehttp://<IP>:8123. - Create your owner account, set your location, unit system, and time zone.
Step 4: Reserve a Static IP
Assign a DHCP reservation in your router for the Pi’s MAC address. A stable IP prevents broken integrations, MQTT clients, and dashboards after router restarts. This is cleaner than setting a static IP inside HAOS.
Pinout and GPIO Notes for Hardware Projects
HAOS is an appliance OS, so you do not run Python scripts on the GPIO header directly. The practical options are:
| Approach | Use Case | Notes |
|---|---|---|
| ESP32/ESP8266 + ESPHome | Sensors, relays, displays | Best practice; keeps the Pi isolated |
| MQTT devices | DIY sensors over Wi-Fi | Needs Mosquitto broker add-on |
| Pi GPIO via add-on | Limited cases | Not officially supported on HAOS |
| Raspberry Pi OS + Container install | Full GPIO access | Loses Add-on store |
For most builds, offload I/O to an ESP32 and let the Pi stay a pure controller.
Essential Add-ons to Install First
- File Editor or Studio Code Server: Edit
configuration.yamlin the browser. - Mosquitto broker: Local MQTT broker (port 1883).
- ESPHome: Compile and flash firmware to ESP32 boards over the network.
- Zigbee2MQTT or ZHA (built-in): Zigbee device control.
- Samba share: Access config files from your PC.
- Advanced SSH & Web Terminal: Command-line access to the host.
ZHA vs. Zigbee2MQTT
| Feature | ZHA | Zigbee2MQTT |
|---|---|---|
| Setup | Built-in, simple | Add-on + MQTT broker |
| Device Support | Broad | Broader, faster updates |
| UI | Home Assistant UI | Separate web frontend |
| Best For | Beginners | Large or exotic device lists |
Real-World Project: ESP32 Temperature Sensor with ESPHome
This build adds a DHT22 temperature and humidity sensor to your hub using an ESP32.
Wiring
| DHT22 Pin | ESP32 Pin |
|---|---|
| VCC | 3V3 |
| DATA | GPIO4 |
| GND | GND |
Add a 10kΩ pull-up resistor between DATA and VCC if your module lacks one.
ESPHome Firmware
esphome:
name: living-room-sensor
esp32:
board: esp32dev
framework:
type: esp-idf
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Native API connects directly to Home Assistant
api:
encryption:
key: !secret api_key
ota:
platform: esphome
logger:
sensor:
- platform: dht
pin: GPIO4 # Data line from DHT22
model: DHT22
temperature:
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
update_interval: 60s # Poll every 60 seconds to limit self-heating
Compile and flash from the ESPHome dashboard. Home Assistant auto-discovers the device and shows it under Settings → Devices & Services.
Simple Automation (YAML)
automation:
- alias: "Fan on when room is hot"
trigger:
- platform: numeric_state
entity_id: sensor.living_room_temperature
above: 28 # Trigger above 28°C
for: "00:05:00" # Must stay above for 5 minutes
action:
- service: switch.turn_on
target:
entity_id: switch.living_room_fan
Best Practices for a Stable Home Assistant Pi
1. Back Up Automatically
Go to Settings → System → Backups and schedule daily automatic backups. Copy them off the Pi with a Samba backup, Google Drive, or Nabu Casa storage. A backup stored only on the Pi is not a backup.
2. Reduce Database Writes
Edit configuration.yaml to exclude noisy entities from the recorder:
recorder:
purge_keep_days: 10 # Default is 10; lower if storage is tight
commit_interval: 30 # Batch writes every 30s to reduce I/O
exclude:
domains:
- updater
entity_globs:
- sensor.*_uptime
- sensor.*_signal_strength
3. Isolate the Radio Hardware
Plug Zigbee and Z-Wave sticks into a USB 2.0 extension cable, 1 meter or longer. Keep them away from the USB 3.0 SSD and Wi-Fi antennas. Set your Zigbee channel to 15, 20, or 25 to avoid overlap with common Wi-Fi channels 1, 6, and 11.
4. Monitor Temperature and Throttling
Use the built-in System Monitor integration to track CPU temperature, memory use, and disk usage. Sustained temperatures above 80°C trigger throttling.
5. Secure the Instance
- Enable multi-factor authentication on your user profile.
- Do not port-forward 8123 to the internet. Use Nabu Casa Cloud, WireGuard, or Tailscale instead.
- Use the Mosquitto add-on with a dedicated user and password, never anonymous access.
- Update Core, OS, and Add-ons monthly, and read release notes for breaking changes.
6. Prefer Local Protocols
| Protocol | Local Control | Mesh | Typical Use |
|---|---|---|---|
| Zigbee | Yes | Yes | Bulbs, sensors |
| Z-Wave | Yes | Yes | Locks, switches |
| Matter over Thread | Yes | Yes | New cross-brand devices |
| Wi-Fi (ESPHome) | Yes | No | DIY sensors |
| Cloud-only APIs | No | No | Avoid when possible |
For Matter, add a Thread border router (many recent smart speakers or a dedicated dongle work) and the Matter Server add-on or integration.
Troubleshooting Common Problems
| Symptom | Likely Cause | Fix |
|---|---|---|
| Random reboots | Undervoltage, weak PSU | Use official 5V/3A or 5V/5A supply |
homeassistant.local not found |
mDNS blocked | Use the IP address |
| Zigbee devices drop offline | USB 3.0 interference | Add a USB 2.0 extension cable |
| Slow UI, high load | Large database, SD card | Move to SSD, lower purge_keep_days |
| Won’t boot from SSD | Outdated EEPROM | Update bootloader, set BOOT_ORDER |
| Add-on won’t start | Low RAM | Use 4GB+ model, stop unused add-ons |
Check Settings → System → Logs first. Most failures leave a clear error line there.
FAQ
Which Raspberry Pi is best for Home Assistant?
The Raspberry Pi 5 (4GB) is the best choice for new builds thanks to its faster Cortex-A76 CPU and NVMe support. The Pi 4 (4GB) remains a reliable option for typical homes with under 100 entities.
Can I run Home Assistant on a Raspberry Pi with an SD card?
Yes, but use a high-endurance SD card and schedule off-device backups. An SSD is strongly preferred because constant database writes wear out SD cards and can corrupt the system.
How much RAM does Home Assistant need on a Raspberry Pi?
2GB is the minimum, 4GB is the recommended baseline, and 8GB only helps if you run heavy add-ons like Frigate, Whisper, or Node-RED alongside Core.
Can Home Assistant run without internet?
Yes. Core automations, Zigbee, Z-Wave, MQTT, and ESPHome devices work fully offline. Only cloud-based integrations and remote access without a VPN need internet.




