# How to use Home Assistant remotely over Meshnet

## Introduction

[Home Assistant](https://www.home-assistant.io/) is the leading free and open-source smart home control system. It enables seamless addition, control, and automation of smart devices without depending on third-party cloud solutions. Since Home Assistant functions locally, it is not reachable from outside without [port forwarding or a VPN](https://nordvpn.com/blog/port-forwarding/) to your home network.

Enter [Meshnet](https://nordvpn.com/meshnet/), a solution that establishes encrypted tunnels between your devices, allowing direct and secure remote access from any device to your Home Assistant instance. With this setup, you can monitor and control your [Internet of Things](https://nordvpn.com/blog/internet-of-things/) (IoT) devices from anywhere in the world.

Watch the video below for an overview of the setup process or follow along with our step-by-step written instructions to set up your own Home Assistant instance in a [Docker container](https://www.docker.com/resources/what-container/) and remotely control it using Meshnet.

{% embed url="<https://www.youtube.com/watch?v=yiNKVJpWhQk>" %}

## Install Docker

To follow this guide, 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 (app 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 this guide, [Docker run](https://docs.docker.com/engine/reference/run/) will be used. If you prefer the [Docker Compose](https://docs.docker.com/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 dedicated [Docker volume](https://docs.docker.com/storage/volumes/) where the container's files will be stored. Without a persistent volume, all of the instance's files are lost once the container is stopped. You can create the volume directly from the Docker Desktop app or via the command line.

{% tabs %}
{% tab title="Using Docker Desktop" %}

1. Open the **Docker Desktop** app.
2. From the menu on the left, select **Volumes**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fv6PTW3CACvycCtrYgJAt%2Fha_docker_volumes_dark.png?alt=media&#x26;token=b7256b82-48d6-42d9-9b73-3d6bc8ec082a" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FiT3GV9EU02F2TTORybm8%2Fha_docker_volumes.png?alt=media&#x26;token=d7a772c4-be31-42ff-a83a-04d09e89d02b" alt="Docker Desktop application"></picture><figcaption></figcaption></figure></div>

   &#x20;
3. If you don't have any volumes created, select the **Create a volume** button. Otherwise, click **Create** in the upper-right corner.
4. In the **Volume name** field, type in `homeassistant_config` and click **Create**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fb0URr6V2NXiHIRpxsrkl%2Fha_docker_volume_create_dark.png?alt=media&#x26;token=35eef926-4238-4f9c-b752-6713570adb03" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fdxh1xdqap2qs4hApJ6Cc%2Fha_docker_volume_create.png?alt=media&#x26;token=b0f5cace-3899-4331-9092-088e0c427842" alt="Name of the new Docker volume." width="375"></picture><figcaption></figcaption></figure></div>

The newly created volume will now be visible in the **Volumes** section.
{% endtab %}

{% tab title="Using the command line" %}

1. Open **Command Prompt** (on Windows) or **Terminal** (on Linux or macOS).
2. Run the following command to create a volume called `homeassistant_config`:\
   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">docker volume create homeassistant_config
   </code></pre>

If the creation is successful, you will see the name of your volume in the command line window.
{% endtab %}
{% endtabs %}

### 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. Depending on your operating system, execute one of the following `docker run` commands, replacing `<TimeZone>` with your [time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones):\
   &#x20;
   * If you're running Windows or macOS, use the command below:

     <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>

     &#x20;\
     **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>

   * If you're using Linux, run this command:

     <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 --network=host ghcr.io/home-assistant/home-assistant:stable
     </code></pre>

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/`\
     &#x20;&#x20;

     <figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FpKlBlpXAZ5ElECtBV5Wi%2Fha_welcome_screen.png?alt=media&#x26;token=017f947f-a636-431d-84c6-83c3f04475a1" alt="Home Assistant account creation screen"><figcaption></figcaption></figure>

     &#x20;
   * Otherwise, you must use the device’s local IP address instead of the `localhost` part.

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.

{% hint style="warning" %}
**Caution**

Ensure you set up strong user authentication. Without it, other devices in your Meshnet that have [remote access permissions](https://meshnet.nordvpn.com/features/explaining-permissions/remote-access-permissions) enabled can interact with your Home Assistant instance, potentially compromising its security.
{% endhint %}

{% hint style="info" %}
**Note**

If you're hosting Home Assistant on a Linux device, you must grant the [local network permission](https://meshnet.nordvpn.com/features/explaining-permissions/local-network-permissions) for the devices accessing it. For more information, see [Common issues on Linux](https://meshnet.nordvpn.com/troubleshooting/linux#cannot-access-docker-containers-over-meshnet).
{% endhint %}

### 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 app.
2. Open your internet browser.
3. Paste the copied Nord name followed by `:8123/` to the URL field and press **Enter**.\
   &#x20;\
   **Example**\
   `secret.meerkat-himalayas.nord:8123/`

   &#x20;
4. Log into your Home Assistant account.

   <figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FiChj4zwLb7e8ZO9bBbEw%2Fha_meshnet_login_dark.png?alt=media&#x26;token=d74f7ccd-cd07-4233-a51e-c5f51d3ae769" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F7vbRh8TFW0zuQijf8N4z%2Fha_meshnet_login.png?alt=media&#x26;token=d957edb4-176a-4e87-8e03-1c31919e82da" alt=""></picture><figcaption></figcaption></figure>

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

<div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FNswecVJQ8IHOTVLhcIBR%2Fha_remote_dash_dark.png?alt=media&#x26;token=c02ee6d9-446f-48ff-9777-761062b3f723" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F4B3U1iERsFLHiguvjOoC%2Fha_remote_dash.png?alt=media&#x26;token=5af1f71a-88b8-4d73-9ac2-f6c625060e77" alt="Home Assistant dashboard"></picture><figcaption></figcaption></figure></div>

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

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 app.
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**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FqP2hwuqo5iA38jvsGGEi%2Fha_android_address_dark.png?alt=media&#x26;token=3d460a70-5edd-4dd2-9e06-427c674fe347" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F7n1UaKtVCevqPxNBy8ir%2Fha_android_address.png?alt=media&#x26;token=c3e5e95a-1aab-4092-835c-5c2ff445c8af" alt="Nord name entered in the Home Assistant application." width="375"></picture><figcaption></figcaption></figure></div>

   &#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 app.
{% endtab %}

{% tab title="macOS" %}

1. Download and install the [Home Assistant app](https://apps.apple.com/us/app/home-assistant/id1099568401) from the macOS 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%2FjumPTv4RTkSpcgt6BuhM%2Fha_mac_address.png?alt=media&#x26;token=c4e34c86-b94f-4d97-87da-a2b9da0130a7" alt="Nord name entered in the Home Assistant application"><figcaption></figcaption></figure></div>

   &#x20;
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 app](https://apps.apple.com/us/app/home-assistant/id1099568401?itsct=apps_box_badge\&itscg=30200) from the iOS App Store.
2. Launch **Home Assistant** and select the app's permissions that you are comfortable with.
3. In the lower-right corner, tap the gear bubble and select **Add server**.
4. If you receive a dialog asking for permission to find local devices, choose **OK**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FoXIyNr8MgaN0DGLcbrWE%2Fha_ios_permission_dark.png?alt=media&#x26;token=c64e3fec-d10a-402b-86fe-73bed93b66ef" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FnnzaApXv7l7ID1rBfmxt%2Fha_ios_permission.png?alt=media&#x26;token=5ceb9fe5-7a79-4df6-9f55-62db62f29326" alt="iOS system message regarding local connections" width="272"></picture><figcaption></figcaption></figure></div>

   &#x20;
5. Tap **Enter address manually**.
6. Type `http://` and paste the Nord name of the device running Home Assistant, followed by `:8123`. Then, tap **Connect**.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FI6sZHU8hlhIR3nhgx6OX%2Fha_ios_address.png?alt=media&#x26;token=314b3e67-e441-47c4-9f97-32009342f993" alt="Nord name entered in the Home Assistant application." width="375"><figcaption></figcaption></figure></div>

   &#x20;
7. Log into your Home Assistant account.

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 access its dashboard remotely with the help of Meshnet.
