Set up Home Assistant on a Raspberry Pi 5

Official Raspberry Pi 5 case

Level: Beginner  ·  Time: 45 minutes  ·  Board: Raspberry Pi 5 (or Pi 4)

Home Assistant is free, open-source software that brings your smart devices together in one place: lights, plugs, speakers, thermostats and sensors from different brands, controlled from one app and automated without a cloud account. Home Assistant OS is a complete operating system built for it. It updates itself and needs no command line, and a Raspberry Pi 5 runs it well.

What you need

You'll also need an Ethernet cable. Home Assistant needs a wired connection for installation; you can switch to Wi-Fi afterwards, but wired stays more reliable.

1. Write Home Assistant OS to the card

Install Raspberry Pi Imager on your computer, insert the microSD card and:

  1. Choose Raspberry Pi 5 as the device.
  2. Under the operating system, choose Other specific-purpose OS → Home automation → Home Assistant, then Home Assistant OS (RPi 5).
  3. Choose your microSD card and write it. Everything on the card is erased.

Imager doesn't offer user, Wi-Fi or SSH settings for this image. That's expected: all setup happens in the browser.

2. First boot

Put the card in the Pi, connect it to your router with the Ethernet cable, then plug in power. On another computer on the same network, open:

http://homeassistant.local/

If that doesn't load, try http://homeassistant.local:8123/, or the Pi's IP address from your router's device list followed by :8123. You'll first see a Preparing Home Assistant page while it downloads the latest version. This can take 20 minutes or more, so leave it running.

While you wait, add a DHCP reservation for the Pi in your router so its address never changes. Phones, tablets and other devices will rely on finding it.

3. Onboarding

  1. Select Create my smart home.
  2. Enter a name, a lowercase username without spaces, and a password. This is the owner (administrator) account. There is no way to recover it, so store the details in a password manager.
  3. Set your home's location by searching for the address or dragging the marker. Home Assistant uses it for your home zone, time zone, units and sunrise and sunset times.
  4. Choose what, if anything, to share on the Help us help you screen. Sharing is off by default.
  5. Finish. Home Assistant shows any devices it has already found on your network.

4. Add your first integrations

An integration connects Home Assistant to a brand or service. Go to Settings → Devices & services:

  • Discovered lists things found automatically, such as smart TVs, Chromecast and Sonos speakers, network printers or a Philips Hue bridge. Select Add and follow the prompts. Hue, for example, asks you to press the button on the bridge.
  • For anything not discovered, select Add integration and search for the brand.

Each integration creates devices (a lamp, a speaker) and entities (its on/off switch, brightness, a temperature reading). Entities are what you put on dashboards and use in automations.

5. Install the companion app

Install the Home Assistant app on your phone from the App Store or Google Play. It finds your server on the home network; log in with the account you just created. The app gives you the dashboards and also adds your phone as a device, with sensors such as battery level and, if you allow it, location for "arriving home" automations. It also lets Home Assistant send you notifications.

6. Your first automation

Automations follow a simple pattern: when something happens (trigger), if conditions are met, then do something (action). Go to Settings → Automations & scenes → Create automation → Create new automation and build one in the editor. For example, turn on a lamp 15 minutes before sunset:

  1. When: add a Sun trigger, event Sunset, offset -00:15:00.
  2. Then do: add the action Light: Turn on and pick your lamp.
  3. Save and give it a name.

Every automation is stored as YAML. Open the ⋮ menu and choose Edit in YAML to see it. With your lamp's entity ID in place, it looks like this:

alias: Lamp on before sunset
triggers:
  - trigger: sun
    event: sunset
    offset: "-00:15:00"
actions:
  - action: light.turn_on
    target:
      entity_id: light.living_room_lamp
mode: single

7. Turn on backups

Go to Settings → System → Backups and set up automatic backups. Home Assistant encrypts them with an encryption key: download the emergency kit it offers and keep it somewhere safe, because a backup can't be restored without that key. A backup that only lives on the Pi won't help if the card fails, so also download one now and then, or add a network share as a backup location.

8. Updates and apps

Available updates for Home Assistant Core and the operating system appear at the top of the Settings page. Read the release notes and install from there; a backup is offered before each update.

Apps (previously called add-ons) extend Home Assistant OS. Find them under Settings → Apps → Install app. Good first picks:

  • File editor to edit configuration files in the browser.
  • Samba share to reach the configuration and backup folders from your computer.
  • ESPHome Device Builder to build your own sensors on ESP32 boards.

Tip: Home Assistant writes to its database all the time, which wears out microSD cards over the years. With the M.2 HAT+ and an NVMe SSD fitted (hardware steps in our NVMe guide), go to Settings → System → Storage → Move data disk and Home Assistant moves its data to the SSD. The SSD must be larger than the card, and everything on it is erased, so take a backup first.

Next steps

  • Build a sensor of your own: the ESP32 ESPHome air-quality kit shows up in Home Assistant once it's on your network.
  • Reach your dashboards safely from anywhere with your own WireGuard VPN rather than opening Home Assistant to the internet.