Now that we’ve got our Home Assistant set up, it’s time to move on to more interesting matters. If you’re anything like me, the first thing you might want to do is control your Home Assistant using a Google Home speaker or the Google Assistant on your phone. And while we’re at it, wouldn’t it also be nice to be able to access the Home Assistant when you’re not at home? Luckily for you, that’s precisely what we’re going to be doing today!
The following steps might want to be avoided by anyone with privacy concerns. Following this guide will open up your Home Assistant to the big, bad internet. It’s more important than ever to set a password for your Home Assistant before going any further (you can find out how to do that in the first part of the beginner’s guide). In this guide, I’ll be showing you how to open your Home Assistant to the internet, configure a custom URL (using Duck DNS) with encryption (using Let’s Encrypt) and what ports you have to open on your Router.
Table of Contents
Creating a URL for Home Assistant with Duck DNS
To get things started, sign up to Duck DNS. Duck DNS is a free dynamic DNS. To put things simply, this service will translate your router’s public IP into an easily remembered URL. You could just enter your router’s public IP into your browser to access Home Assistant, but there is one main drawback. The main reason you can’t just use the router’s IP is because it changes. Duck DNS will regularly check your IP and update the settings, so you will always have access to your Home Assistant.
Adding a new domain to Duck DNS
Once you’ve signed up to Duck DNS, you can add a new domain. Just enter your desired URL into the field following http
:// and click on add domain
. In the top half of the window, you’ll also see some information like your account name and account type. Keep this window open because we’ll need the token
later on.
Next it’s back to the Home Assistant. Access it by entering the device’s IP followed by :8123
(how to find your device’s IP) or hassio.local:8123
into your browser of choice. Access the add-on store (it’s located under Supervisor
in the menu), and look for the add-on Duck DNS
. Install the Duck DNS add-on and enter the add-on’s settings by clicking on its card. Below, you can see the default settings:
Remember that token we saw on the Duck DNS website? It’s time to copy that and enter it into your Duck DNS settings. Enter the token and domain you registered, so your settings look like the following:
{
"lets_encrypt": {
"accept_terms": true,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem"
},
"token": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"domains": [
"YOURDOMAIN.duckdns.org"
],
"seconds": 300
}
Home Assistant web access configuration
Unfortunately, the Duck DNS add-on doesn’t take care of quite everything and there are a few lines of code we’re going to have to add to the Home Assistant’s configuration.yaml
file. Open the file using your favourite editor and enter the following:
http:
api_password: YOUR PASSWORD
base_url: YOUR DUCK DNS URL
ssl_certificate: /ssl/fullchain.pem
ssl_key: /ssl/privkey.pem
As you can see in my screenshot, I’ve not included the api_password
and base_url
in my configuration.yaml
file and have instead added these to the secrets.yaml
file (more about that here).
Port forwarding your Home Assistant
The final step is telling your router what device to look for when entering the URL into your browser. This is achieved by port forwarding. This step will be a bit different for everyone because all router interfaces look a bit different. Somewhere in the settings you’ll find the option port forwarding, and you’re going to want to enter the following:
Entry port: Single port / 443
Protocol: TCP
Device: hassio
Destination port: Single port / 8123
Finishing up
The final step will be to check your configuration in the Home Assistant interface and restart it. You should now be able to access the Home Assistant using the custom .duckdns.org domain you’ve chosen!