Contents

Installing Home Assistant with HACS and Tailscale

Introduction

In this guide, we will see how to install Home Assistant using Docker, how to add the HACS (Home Assistant Community Store) plugin to extend functionality with custom components, and how to use Tailscale to securely connect without the need for port forwarding. With this setup, you will be able to easily manage Home Assistant, access it remotely securely, and without complications.

Advantages of this setup:

  • Advanced security with Tailscale (VPN) and Home Assistant.
  • Easy management with Docker for Home Assistant and HACS.
  • Secure remote access without port forwarding.

Prerequisites

Before you start, make sure you have:

  • A local server to run Home Assistant (could be a PC, Raspberry Pi, Intel NUC, etc.);
  • Docker and Docker Compose installed on the server;
  • A GitHub account (required for installing HACS);
  • Tailscale to create a secure VPN for remote access.

1. Installing Docker and Docker Compose

If Docker and Docker Compose are not already installed, follow these steps to install them:

Installing Docker:

1
2
3
4
5
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER

Installing Docker Compose:

1
2
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Verify that Docker and Docker Compose are installed correctly:

1
2
docker --version
docker-compose --version

2. Installing Home Assistant with Docker

Creating the configuration directories

To keep everything organized, create a folder for Home Assistant’s data:

1
mkdir -p /opt/homelab/homeassistant

Creating the Docker Compose file for Home Assistant

Inside the folder you just created, create a file named docker-compose.yml with this configuration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /opt/homelab/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: always
    privileged: true
    network_mode: host

Starting the Home Assistant container

Start the Home Assistant container with the command:

1
2
cd /opt/homelab/homeassistant
sudo docker-compose up -d

Now, Home Assistant will be running and accessible at http://localhost:8123.


3. Installing HACS (Home Assistant Community Store)

To expand Home Assistant’s functionality, you can use HACS, which allows you to add community integrations and components.

Download and install HACS

Run the following script to download and install HACS:

1
2
3
wget https://get.hacs.xyz -O /opt/homelab/homeassistant/config/hacs.sh
sudo apt install zip -y
sudo bash /opt/homelab/homeassistant/config/hacs.sh

Restart Home Assistant

After installing HACS, restart the Home Assistant container to apply the changes:

1
2
3
cd /opt/homelab/homeassistant
sudo docker-compose down
sudo docker-compose up -d

Add HACS to Home Assistant

  1. Go to Settings > Devices & Services.
  2. Click the “+” button at the bottom and search for HACS.
  3. Follow the instructions to link your GitHub account and complete the installation.

Now you can access all the Home Assistant community integrations and components through HACS.


4. Configuring Tailscale for Secure Access

To ensure that access to Home Assistant is secure even remotely, we use Tailscale, a VPN that allows you to access your devices securely, without port forwarding.

Installing Tailscale

Install Tailscale on the server and the devices from which you want to access Home Assistant.

  1. Install Tailscale on the server:
1
2
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
  1. Install Tailscale on the devices (PC, smartphone, etc.):

Download Tailscale from the official site for all the devices you want to use to access Home Assistant.

Connect the server to the Tailscale network

Run the command sudo tailscale up to connect your server to the Tailscale network. After logging in, you will get a private IP for your server.

Access Home Assistant via Tailscale

Now you can access Home Assistant using the private Tailscale IP, without port forwarding. For example, access Home Assistant via:

1
http://<Tailscale_IP>:8123

5. Secure Remote Access without Port Forwarding

Thanks to Tailscale, there is no need to do port forwarding on your router. You can access Home Assistant from any device with Tailscale installed, securely, via the private VPN.


6. Conclusion

Now you have a secure and scalable Home Assistant setup with HACS for integrations, and remote access through Tailscale without port forwarding. This setup allows you to:

  • Access Home Assistant securely and remotely without exposing the server to the internet.
  • Easily manage your system with Docker and HACS.
  • Keep your system secure thanks to the Tailscale VPN.

Additional resources:


With this guide, you’ve learned how to set up Home Assistant with the HACS plugin and secure remote access using Tailscale. Enjoy your home automation setup!

Need help?

If something isn’t working as it should, don’t worry, you’re on the right track. Double-check to make sure the prerequisites are met and start with a clean environment. If you’re still having trouble, feel free to leave a comment so I or someone else can help you out.