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.

Notice:

This post has been marked as a legacy post and has been flagged to be updated.

If you would like to receive updates from Smart Home Hobby, please subscribe below.


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

https://gist.github.com/smarthomehobby/0cf42ee15805e004719fb3a548a0541b

  • 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!

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

  • October 19, 2017 at 11:08 am
    Permalink

    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

    Reply
  • October 19, 2017 at 11:09 am
    Permalink

    i mean i create one with duckdns.org but cant reach it

    Reply
    • October 19, 2017 at 11:19 am
      Permalink

      Hey Johnny, it’s hard to say. If you followed the guide and still can’t access it, check your error log and see if anything in there stands out.

      Reply
    • October 21, 2017 at 12:57 pm
      Permalink

      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.

      Reply
  • March 14, 2021 at 6:22 am
    Permalink

    Undeniably believe that which you stated.
    Your favorite reason appeared to be on the net the simplest thing to be aware of.
    I say to you, I certainly get irked while people think about
    worries that they just do not know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side-effects
    , people could take a signal. Will probably be back to get more.

    Thanks

    Reply

Leave a Reply