TL;DRTo put your Home Assistant instance online with ngrok:
- Start Home Assistant locally in a Docker container
- Add ngrok to the Docker container
- Allow trusted proxies in Home Assistant
- Docker Desktop
- Docker Compose
- ngrok installed on your machine
- Basic familiarity with the command line
Step 1: Initial setup
-
Create a directory called
home-assistant
-
Inside the
home-assistant
directory:
- create your Docker Compose file called
compose.yaml
- create a directory called
config
Step 2: Run Home Assistant in a Docker container
- Update
compose.yaml
:
- In your terminal, start a Docker container with this compose.yaml file:
- Visit localhost:8123 in your browser. You should see your Home Assistant login page:
Step 3: Add ngrok
- Add ngrok to your
compose.yaml
under the services section:
- In your terminal, restart your Docker container with this compose.yaml file:
-
Visit your ngrok dashboard to see the endpoint URL:
-
If you visit the ngrok URL, you’ll get a 4xx response:
Step 3: Allow trusted proxies in Home Assistant
- In your
/home-assistant/config
directory, look for the file calledconfiguration.yaml
. By default, it should already have these settings:
- Restart the Docker container so the updated Home Assistant configuration can take effect.
-
Visit your ngrok endpoint URL and see your Home Assistant instance online!