Remotely Access Home Assistant – Port Forwarding & DuckDNS

Home Assistant is pretty easy to configure for remote access. Using a service, like DuckDNS you can create a personalized URL to connect to your Smart-Home set-up. This will only take a couple of steps.

  1. Forward port 8123
  2. Create a domain using DuckDNS.
  3. Set a password.

Some info before we get started:

  • Your internet service provider has assigned you a public IP address. Similar to your home address, it can be used to navigate to your specific place on the internet.
  • Sometimes this number can change automatically (dynamic IP).
  • Services like Duck DNS will make your public IP address available at a URL and can automatically update in case your IP address changes.

Forward port 8123

  • Home Assistant, by default, runs on port 8123 on your router.
  • In order to reach this port while not connected to the network, you need to make it available for traffic.
  • To do this you’ll need to forward port 8123 on your router. I have a Ubee router from Spectrum. Yours may look different.
  • My port forwarding page is located under the Advanced tab.

Screen Shot 2017-09-18 at 2.44.21 PM

  • Clicking “Create IPv4” brings me to this form. Remember, doing this will expose you to the internet.

Screen Shot 2017-09-18 at 2.44.47 PM.png

For the IP, use your Raspberry Pi‘s IP address. This will make your raspberry pi (using port 8123) accessible from your public IP address (at port 8123). You can try this now in your browser or on your phone. You can now reach your Home Assistant page by typing YOURPUBLICIPADDRESS:8123 in the address bar. If you don’t know your public IP address, this site will display it for you. Remember, your public IP address routes directly to you, you should consider keeping this private.

Create A Subdomain Using DuckDNS

Now, wether or not your IP address is dynamic or static, you’d hate to have to use it to link to your Home Assistant page.

  • DuckDNS is a service that will allow you to use a URL to reach your address. It will also update, using the Raspberry Pi, if your IP address changes. So you just have to remember your URL.
  • To get this set up, go to DuckDNS.org, create an account, and log in.

Screen Shot 2017-09-17 at 5.30.03 PM

  • Type in a unique subdomain name. This will connect that URL to your public IP address.

Screen Shot 2017-09-17 at 5.33.22 PM

  • Now go to the Hass.io tab in Home Assistant and click on the shopping bag in the top-right corner.

Screen Shot 2017-09-17 at 5.41.55 PM

  • Scroll through the Add-On’s list, find the Duck DNS add-on, and click install.

Screen Shot 2017-09-17 at 5.43.04 PM

  • Once installed, open the Add-On.

Screen Shot 2017-09-17 at 5.51.38 PM.png

  • Use the information you just got from DuckDNS. It should look similar to this.
{
 "token": "YOUR-DUCK-DNS-TOKEN",
 "domains": [
 "YOURSUBDOMAIN.duckdns.org"
 ],
 "seconds": 300
}
  • Remember to save!
  • Then click START.
  • Now, navigate to your “configuration.yaml” file and look for the http: component.
  • Since your set up will be accessible on the internet, it’d be a great idea to add a password now.
  • Uncomment the password line and base URL line by removing the #. Fill in with your information.

Screen Shot 2017-09-17 at 6.08.32 PM

  • Save, check your configuration, and restart Home Assistant.
  • After this, you may lose access via http://hassio.local:8123
  • You should still be able to connect locally, by using http://YOURRASPBERRYPI’SIP:8123
  • More importantly, you can now reach your set up remotely using your subdomain like this, YOURSUBDOMAIN.duckdns.org:8123 !

Screen Shot 2017-09-18 at 3.22.02 PM

  • Now you can access your Smart-Home set up from anywhere on any device!
  • You can also add a web app to your phone.
  • Navigate to your URL, open the browser menu, and add to home screen.
  • This will let you access Home Assistant quickly from your device. How cool is that?

 

While this makes things awesome and convenient, it can be vulnerable to others seeing your traffic. I don’t really know how that would work or what they could do besides turn my stuff off. I kept my set up like this for a few months before finally encrypting it. You can encrypt the traffic to your page pretty easily, with the newer Hass.io settings.

If these guides have been helpful to you , please share them! If you have any questions, please reach out to me in the comments. Thanks for visiting!

5 thoughts on “Remotely Access Home Assistant – Port Forwarding & DuckDNS

  1. hey, i cant reach my smart home via YOURSUBDOMAIN.duckdns.org:8123 …
    what could be the problem? i can reach my rasp pi via raspi ip adress:8123 but not on subdomain

    Like

    1. I think you’ve already got encryption working if you’re using https. The forwarding 8123 to 443 is not necessary for encryption.

      The new duckdns add-on does support encryption, but based on what I’ve seen in the community, the docs are incomplete so it may be confusing to use currently. You can use whichever method you’d like, they both work.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s