# How to use Home Assistant over Meshnet

## Introduction

Nowadays, many homeowners use [Internet of Things](https://nordvpn.com/blog/internet-of-things/) (IoT) devices. They can vary from a simple light bulb to a smart thermostat. As the number of these appliances grows, managing them individually may become challenging. To resolve this problem, various management software options are available, the most popular of which is Home Assistant.

[Home Assistant](https://www.home-assistant.io/) is a free and open-source smart home control system. It allows you to add, control, and automate smart home devices. Home Assistant works locally, so you do not depend on third-party cloud solutions and do not have to worry about being unable to control your home appliances if the internet goes down.

On the other hand, you may want to control your devices while away on a business trip or family vacation. Since Home Assistant functions locally, it is not reachable from outside without [port forwarding](https://nordvpn.com/blog/port-forwarding/) or a VPN connection to your home network. This is where Meshnet comes into play.

[Meshnet](https://nordvpn.com/meshnet/) establishes encrypted tunnels between your devices. This configuration allows you to swiftly and securely access your device from anywhere in the world.

This guide is designed to show you how to set up a Home Assistant instance in a [Docker container](https://www.docker.com/resources/what-container/) and control it remotely using Meshnet.

## Install Docker

To begin the configuration, you must have Docker installed on your device. You can find instructions for downloading and installing Docker on the Docker website:

* [Docker Desktop instructions for Windows](https://docs.docker.com/desktop/install/windows-install/)
* [Docker Desktop instructions for macOS](https://docs.docker.com/desktop/install/mac-install/)
* [Docker Desktop Instructions for Linux (application with a GUI)](https://docs.docker.com/desktop/install/linux-install/)
* [Docker Engine instructions for Linux (CLI only)](https://docs.docker.com/engine/install/)

## Create a Home Assistant Docker container

With Docker installed, you can start creating Docker containers for various services, including Home Assistant.

For the purpose of this guide, [Docker run](https://docs.docker.com/engine/reference/run/) will be used. If you prefer the [Docker compose](https://docs.docker.com/get-started/08_using_compose/) method, you can find instructions on the [Home Assistant website](https://www.home-assistant.io/installation/alternative/#docker-compose).

### Creating a volume

First, you need to create a specific [Docker volume](https://docs.docker.com/storage/volumes/) (directory) where the container’s files will be stored.

#### Method 1: Using Docker Desktop

This method utilizes the Docker Desktop application to create a volume for the Home Assistant Docker container.

1. Open the **Docker Desktop** app.

2. From the menu on the left, select **Volumes**.<br>

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FjY4sJ4MoUPBoycocysJG%2Fwin_docker_volumes.png?alt=media&#x26;token=bbe97f50-4637-49ed-9da8-66d1f5efba29" alt="Docker Desktop application"><figcaption></figcaption></figure></div>

3. Click the **Create** button in the upper-right corner.

4. Name it `homeassistant_config` and click **Create**.\
   \
   ![Name of the new Docker volume](https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FISNN4z3U5j80xCG0xDdC%2Fwin_docker_volume_create.png?alt=media\&token=7a051317-fdd5-4102-9291-26ede5b26fff)<br>

5. The newly created volume will now be visible in the **Volumes** section.

#### Method 2: Using the command line

This method shows you how to create a volume for your Home Assistant Docker container via the command line.

1. Open **Command Prompt** (on Windows) or **Terminal** (on Linux or macOS).
2. Run the following command to create create a volume called `homeassistant_config`:<br>

   ```bash
   docker volume create homeassistant_config
   ```

If the creation is successful, you will see the name of your volume in the command line window.

### Creating a container

With the volume ready for Home Assistant, you can proceed to create the Docker container itself.

1. Open **Command Prompt** (on Windows) or **Terminal** (on Linux or macOS).
2. Execute the following `docker run` command, replacing `<TimeZone>` with your [time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones):<br>

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">docker run -d --name homeassistant --privileged --restart=unless-stopped -p 8123:8123 -e TZ=&#x3C;TimeZone> -v homeassistant_config:/config ghcr.io/home-assistant/home-assistant:stable
   </code></pre>

   \
   **Example**

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fl2MrjT0v5pe8xkrl0qI8%2Fwin_docker_run_edited.png?alt=media&#x26;token=a268074d-0450-4f6a-b688-07dc72541fae" alt="Example docker run command to deploy a Home Assistant container"><figcaption></figcaption></figure></div>

Docker will [pull the Home Assistant image](https://docs.docker.com/engine/reference/commandline/pull/) from Docker Hub and create the container.

If the creation is successful, you will see the full container ID of your Home Assistant container in the command line window.

## Set up Home Assistant

Once the container is running, you can start using Home Assistant. By default, the Home Assistant service listens on port 8123, unless you've configured it differently.

1. Open your internet browser and visit your Home Assistant page.\
   \
   • If you are accessing Home Assistant from the host device directly, you can use the following URL:\
   `http://localhost:8123/`<br>

   • Otherwise, you must use the device’s local IP address instead of the `localhost` part.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F3mCnjQJ94DfyJQPNEEwq%2Fha_welcome_page.png?alt=media&#x26;token=6b50e996-3f9d-41c2-8b58-45bb2d7ff7c4" alt="Home Assistant account creation screen"><figcaption></figcaption></figure></div>

2. Create your Home Assistant account and finish the setup process.

Now, when you visit your Home Assistant page again, you will be prompted to log in to your account. Upon logging in, you will be taken to your Home Assistant dashboard, where you can configure your devices and services.

## Access Home Assistant remotely

Your Home Assistant is now fully set up. With Meshnet enabled on the host device, the Home Assistant dashboard can be [accessed remotely](https://nordvpn.com/meshnet/remote-access/) by other devices in your Meshnet.

### Method 1: Using an internet browser

The easiest way to manage your Home Assistant remotely is via an internet browser.

1. Copy the Nord name of the device running Home Assistant from the NordVPN application.

2. Open your internet browser.

3. Paste the copied Nord name followed by `:8123/` to the URL field and press **Enter**.\
   \
   **Example**\
   `secret.meerkat-andes.nord:8123/`

   &#x20;

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F6yI3zDxzC6Yx8Tm5xYrm%2Fha_remote_login.png?alt=media&#x26;token=f473dfac-eab7-47f5-8947-6ea003ee7480" alt="Home Assistant login page accessed by using the devices Nord name"><figcaption></figcaption></figure></div>

4. Log into your Home Assistant account.

The Home Assistant dashboard will load, and you will have full control over it from your internet browser.

<div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fj9D9AZ6Xz3eCReVfktu4%2Fha_remote_dashboard_web.png?alt=media&#x26;token=e4a8e2dd-2c57-421e-b1c1-a4548d25e919" alt="Home Assistant dashboard"><figcaption></figcaption></figure></div>

### Method 2: Using the Home Assistant companion application

You can also access the Home Assistant dashboard remotely through the companion app. However, it is currently available only on Android, macOS, and iOS.

{% tabs %}
{% tab title="Android" %}

1. Download and install the [Home Assistant app](https://play.google.com/store/apps/details?id=io.homeassistant.companion.android) from the Google Play Store.
2. Copy the Nord name of the device running Home Assistant directly from the NordVPN application by tapping it.<br>

   ![Nord name highlighted in the NordVPN application](https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FnxN17gmkjEhzWW7HrCAi%2Fandroid_nord_name.png?alt=media\&token=d7c97ee6-5e6a-4d5f-b8c1-190771a4fe57)<br>
3. Open Home Assistant and tap **Continue**.
4. Select **Enter address manually**.
5. In the **Home assistant URL** field, type `http://` and paste the Nord name of the device running Home Assistant, followed by `:8123`. Tap **Connect**.\
   \
   ![Nord name entered in the Home Assistant application](https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FuGjDJGoC5SpknkCG1o9y%2Fandroid_ha_connect.png?alt=media\&token=a8a88e7a-3c2d-46ad-ac8c-c38e707cf27c)

   &#x20;
6. Log into your Home Assistant account.
7. Choose the name of your device, select the notification preferences, and tap **Continue**.

Once the setup process is complete, you will have full access to your Home Assistant dashboard using the mobile companion application.
{% endtab %}

{% tab title="macOS" %}

1. Download and install the [Home Assistant application](https://apps.apple.com/us/app/home-assistant/id1099568401) from the Apple App Store.

2. Copy the Nord name of the device running Home Assistant directly from the NordVPN app.

3. Open Home Assistant and click **Continue**.

4. Click **Enter address manually**.

5. Under **Enter URL**, type `http://` and paste the Nord name of the device running Home Assistant followed by `:8123`. Click **Connect**.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F0xVEI9L6VY2sIVF9um7Z%2Fmac_ha_app_login.png?alt=media&#x26;token=52455e94-6c9f-46df-81e5-c810ddd4ea01" alt="Nord name entered in the Home Assistant application"><figcaption></figcaption></figure></div>

6. Log into your Home Assistant account and configure the permission and notification preferences.

Once the setup process is complete, you will have full access to your Home Assistant dashboard using the companion application.
{% endtab %}

{% tab title="iOS" %}

1. Download and install the [Home Assistant application](https://apps.apple.com/us/app/home-assistant/id1099568401?itsct=apps_box_badge\&itscg=30200) from the Apple App Store.
2. Copy the Nord name of the device running Home Assistant directly from the NordVPN application by tapping it.<br>

   ![Nord name highlighted in the NordVPN application](https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FMV1LuEvKMqQLYG4rBA2D%2Fios_nord_name.png?alt=media\&token=2b74cfe5-e746-46ba-b034-31e3d80ac5b7)

   &#x20;
3. Open Home Assistant and tap **Continue**.
4. If you get a message asking for permission to find local devices, select **OK**.<br>

   ![iOS system message regarding local connections](https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F5MQIw5F7cdwTVDzoUiLl%2Fios_local_permission.png?alt=media\&token=8b188daf-29ef-4739-94c4-1b4f1cd7fea0)<br>
5. Tap **Enter address manually**.
6. Type `http://` and paste the Nord name of the device running Home Assistant, followed by `:8123`. Tap **Connect**.<br>

   ![Nord name entered in the Home Assistant application](https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fq4rt8t1WRJBjcFdKShDd%2Fios_ha_connect.png?alt=media\&token=35c048fd-f007-4835-bfa2-3347de8ee609)

   &#x20;
7. Log into your Home Assistant account and configure the permission and notification preferences.

Once the setup process is complete, you will have full access to your Home Assistant dashboard using the mobile companion app.
{% endtab %}
{% endtabs %}

You have successfully configured Home Assistant and can now control its dashboard remotely with the help of Meshnet.
