Home Assistant is a popular open-source home automation platform that allows you to control and monitor devices in your home from a single interface. By installing Home Assistant on a homelab, you can have your own personal home automation system that you control.

In this blog post, I’ll guide you through the process of installing HomeAssistant on a Raspberry Pi using Portainer.

Prerequisites Link to heading

  • Raspberry Pi 4 setup and updated
  • Portainer installed
  • Nginx Proxy Manager service installed

Step 0 - Define local mount folders Link to heading

Service will use local folders, mounted to docker container, to store its data.

For service we will need to create folder:

  • /ssd/hass/config
  • /ssd/hass/addons
mkdir -p /ssd/hass/config
mkdir -p /ssd/hass/addons

Step 1 - Install HomeAssistant Link to heading

With Portainer installed, it is possible to start new stack. To do this, follow these steps:

  • Open Portainer in your web browser and navigate to the “Stacks” page
  • Click the “Add stack” button
  • Enter a name for the stack (e.g., “homeassistant”) and paste the following code into the “Web editor” section:
version: '3'

services:

  server:
    image: homeassistant/home-assistant:latest
    volumes:
      - /ssd/hass/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    network_mode: host
    ports:
      - "8123:8123"

Note: network_mode: host. This config is required to have access to Bluetooth adapters to read measurements from BLE sensors.

Step 2 - Configure Link to heading

Once the HomeAssistant stack is running, you can access the web interface by navigating to http://<homelab>:8123.

The first time you access the web interface, you’ll be prompted to set up your Home Assistant instance. After you set up your instance, you can start adding devices and automations to your Home Assistant setup.

Step 3 - Configure Proxy Link to heading

Now your HomeAssistant is accessible on http://<homelab>:8123. Such URLs with port number do not look too friendly. However, there should be Nginx Proxy Manager installed and running already, if followed Homelab. Proxy. It allows to create proxied hosts and assign them nice names:

  • Add new Proxied Host
  • Fill required information
    • Domain names. Assume router is configured to pass domain home to homelab. Then, lets assume HomeAssistant should be a subdomain hass. Then define domain name hass.home. It is possible to assing multiple domain names
    • Forward hostname: <homelab-ip>
    • Forward port: 8123.

Configuring known hosts Link to heading

HomeAssistant block proxy requests from unknown hosts. After configuring host, it wont be accessible. To fix this, edit HomeAssistant configuration file, located under /ssd/hass/config/configuration.yaml. Add Nginx Proxy Manager container IP:

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.22.0.0

IP address of proxy can be found from Portainer UI, or try to access HomeAssistant by DNS name and then check logfile /ssd/hass/config/home-assistant.log.

TO BE CONTINUED… Link to heading

And that’s it! You now have HomeAssistant running on your homelab. Now you can proceed with connecting IoT devices, logging and monitoring them.

In the following post Homelab. Catalog, I will describe how to create simple catalog page for homelab services.