Home assistant is a very versatile home automation solution. However, as it is a system generally hosted within your own network if you want to access on your phone or laptop while out of the house you’ll need to setup a dynamic DNS service.
Also, some smart home devices only work locally within your network. If you can link these devices to Home Assistant then you can control these devices while outside of your network.
Home assistant has a native integration with Duck DNS. The following guide will teach you how to enable external access to your home assistant setup using Duck DNS. Don’t let the name put you off, its a great free service!
Configure Dynamic DNS with Home Assistant
Create a Duck DNS Account
Go to https://duckdns.org and create an account.
Create a Domain within Duck DNS
Complete the box as shown above with an appropriate name. You may need to be slightly creative as the domain name must not already be in use by another user. I would also keep this generic as to not give away the purpose you are using it for – don’t call it homeassistant256 for example.
Keep the Duck DNS page open as some of the information will be required in a later step.
Locate the Duck DNS Addon within Home Assistant
Within Home Assistant, Click Supervisor on the bottom left menu.
Click ‘Add-on Store’ from the top menu.
Find Duck DNS and click it to open the duck DNS installation screen.
Install Duck DNS
Simply locate the install button as shown above and click it.
Configure the Duck DNS Addon
Select the ‘Configuration’ tab from the Duck DNS Installation screen.
Copy the token from your Duck DNS Account page and paste next to ‘Token:’
Under ‘Domain’ Enter the unique domain you created within your Duck DNS account. The example I used above would be ‘mydomain123.duckdns.org’
Update your configuration.yaml as above replacing the blanked out word for your duck dns domain name. In the example above this would be ‘mydomain123’.
The entries for SSL will enable secure HTTPS connections. This is optional but advised
The ‘ip_ban_enabled’ & ‘login_attempts-threshold’ is advised to help prevent fraudulent access attempts. Don’t forget, DUCK DNS is essentially presenting your Home Assistant installation publicly to the internet. Also ensure you have a string username and password on your Home Assistant installation.
We’re not done just yet. Now we need to enable your home router to allow traffic through from Duck DNS to your Home Assistant instance.
Ensure Home Assistant is operating on a static IP.
If you have not done so already we strongly advise you ensure Home Assistant has a static IP applied. We need to give access to HA to the internet and this will reduce potential exposure to your network.
Please see our guide for doing this. Located Here.
This guide was made using TP Link routers but it is generally a very similar process for other manufacturers.
Assign a Port Forwarding Rule within your Router
Log into your routers LAN settings
In the TP Link router used in the example the setting is called ‘virtual servers’ However, often other brands of routers refer to this process as port forwarding.
Find this setting and add an entry for port 8123 to the (static) IP address Home Assistance is using (reference as ‘Internal IP’ in the above image).
Home Assistant operates on port 8123 and so we want to allow all internet traffic hitting our router on that port to be send to the home assistance installation.
You can now access your installation of Home Assistant from outside your network (house). This will also work for the Home Assistant App running on mobile data connections on your smart phone.