Home Assistant tutorial: access from the outside

Previously we created our installing Home Assistant OS on Raspberry Pi et manipulated the Home Assistant interface as well as installed our first add-on, file editor. Today we will reiterate the action with theinstalling the Duck DNS add-on. This plugin will allow us to access Home Assistant from the outside, but also to prepare our system for to integrate Amazon Alexa.

This tutorial may seem a bit more complex, but don't worry, I'll go through the different steps so you don't lose anyone. If you have any question or problem, please feel free to leave a comment or ask on our Facebook group, Alexians will gladly help you.

Duck DNS is a free and secure tool allowing you to access your Home Assistant instance from any internet connection.

Accessing Home Assistant from the outside: the perfect duo with Duck DNS!

  1. To start, go to " Supervisor ", in the tab "Add-on store".
    Duck DNS plugin Home Assistant
    Duck DNS plugin Home Assistant

     

  2. Look for the plugin "Duck DNS" then click on it.
  3. Install the plugin by simply clicking on install :
Installing duck DNS
Installing duck DNS

Configure Duck DNS on Hass.io

While the add-on is installing, next Home Assistant, we will configure DNS Duck, for that go to the site duckdns.org .

  1. Connect using one of the suggested suggestions:
    DuckDNS connection
    DuckDNS connection

     

  2. Then create your domain name (This name will be the URL to access your Home Assistant instance):
    domainDuckDNS
    Here the domain will be lesAlexiensTuto.duckdns.org

     

  3. Click on "add domain", your identifiers will appear as well as your token:

    DNS Duck
    Duck DNS after adding the domain

     

Configuring the IP address for external access to Home Assistant

  1. Before continuing we will check our IP address.
  2. Access the site whatismyip.com then wait a few seconds, your WAN IP address will be displayed in the IPV4 and IPV6 formats:
    WAN IP
    WAN IP

     

  3. Copy the IPv4 address then paste it in the box "Current IP" then do "Update ip" : (Example IPv4: 90.123.456.78) Duckdns.org - Your IP
    Duckdns.org - Your IP
  4. Do it same operation for IPv6.(Exemple IPv6 : 2019:0db8:0000:38a3:0000:0000:ac1f:8001)

DuckDNS add-on configuration

Copy your token which is on the site then return to your interface Home Assistant. The add-on is installed, we will go to the bottom of the page in order to paste the token as well as your domain in the "Config":

Configuring DuckDNS in Home-Assistant
Configuring DuckDNS in Home-Assistant

Your setup should look like this. Don't forget to put accept terms on true and save clicking on save.

You can now start the add-on clicking on start :

Start Duck DNS add-on
Start Duck DNS add-on

Add certificates to Home Assistant

We will add the certificates so that our connection is secure (HTTPS). For that nothing very complicated, go to the page file editor then select the file configuration.yaml :

 

Configuration.yaml Hassio
Configuration.yaml Hassio

 

Remove the # before http et base_url and add the following lines :

http:
  base_url: your_domain.duckdns.org:8123
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem

Your configuration file should look like the screenshot above with your base_url. Once this is added, save the file from the small floppy disk at the top right of the screen.

Adding lines ssl_ allows you to indicate the path of our certificates which allow a secure connection in HTTPS (you know, the little green padlock…).

Restart your server so that the system properly supports our modifications from the page: Configuration> Server control> Restart

Congratulations, you have integrated the Duck DNS add-on into your system!

 

Configure your router

We will now connect our server Home Assistant to the Internet by opening a port on our router (Internet Box).

I perform the operation on an ISP Orange box (Livebox 4). The operation remains the same for the other operators.

From livebox /  ( 192.168.1.1, 192.168.0.1 it all depends on your operator and / or your network settings), you access a login page:

Orange home page
Orange home page

Port forwarding

Once logged in, go to the page advanced settings then click on the tab Network :

Port forwarding tab
Network tab

 


On the network page select theNAT / PAT tab (or PORT FORWARDING):

Port forwarding
Port forwarding - Orange or SOSH

Example on the SFR interface:

NAT SFR
NAT SFR

Thanks Yann for the screenshot!

We will create a rule which will redirect port 8123 of our internet box to our internal port used by Home Assistant which is 8123 also.

  • Application / Service : HTTPS
  • Internal port: 8123
  • External port: 8123
  • Protocol: TCP
  • Equipment: Select or insert the IP address of your Raspberry Pi used for our Home-Assistant server.

Once created, the rule will be displayed just below as in the previous screenshot. It will therefore be activated and functional.

Fixed IP address

The IP address of our Home Assistant server must be fixed to always find its way.

This is also done from your router (internet box). From the DHCP tab you can configure static DHCP leases as below:

Raspberry Pi Fixed IP
Raspberry Pi Fixed IP

Replace the IP address with that of your raspberry and the MAC address as well.

Finalize the installation

Restart your Home Assistant server a second time then access your instance from your created URL. (Example: https://lesalexienstuto.duckdns.org:8123)

Our Home Assistant instance is now accessible from the outside!

If you have any concerns, do not hesitate, it is with pleasure that I will help you in the comments or on the facebook group.

In a future tutorial, we will integrate devices from file editor in order to familiarize ourselves with this interface! 🙂

Several feathers of enthusiastsAlexa to concoct articles with 4 or more hands ... Collaborative writing to address the most specialized or transversal subjects, the best home automation and connected home plans on the web, and much more ...