![]() |
|
Home Assistant Remote Access using DuckDNS and LetsEncrypt - Printable Version +- Comfort Automation/ Security System Forums (https://www.comfortforums.com) +-- Forum: Software Applications (https://www.comfortforums.com/forum-4.html) +--- Forum: Comfort with Home Assistant (https://www.comfortforums.com/forum-143.html) +--- Thread: Home Assistant Remote Access using DuckDNS and LetsEncrypt (/thread-5628.html) |
Home Assistant Remote Access using DuckDNS and LetsEncrypt - slychiu - 04-24-2025 This is a guide to setting up encrypted remote access using DuckDns and Lets encrypt to secure the connection. This content is mainly from https://smarthomeaddict.co.uk/2022/07/home-assistant-remote-access-using-duckdns-and-letsencrypt/ which is one of the best guides. Why this method?
![]() The domain will then appear below. To link your account with the addon, select and copy the string in the token field. Donât give anybody this token, as itâs a security risk to share it. Next Install the DuckDNS addon. Go to Settings, Addons and then click on Addon Store. Click DuckDNS. Click Install. Once itâs installed, enable the watchdog and go to the Configuration tab. As you can see, we need some information to add to the config. ![]() add the duckdns URL in the domains box eg xxxx.duckdns.org You should see the same URL above the Domains box with an X. Warning - you may see another X on the left. Press X to delete this blank domainotherwise the add on will not work. This caused me a lot of time to sort it out Also when you copy and paste the token from the duckdns page, check that there are no spaces in the front of the token. By default the token is copied with one or more spaces. In the Letâs Encrypt section, change false in accept terms to true in order to allow the addon to request an SSL certificate. Finally click Save. We now need to let Home Assistant know itâs using an SSL certificate. To do this, edit the configuration.yaml file and add an http section, then add the following two lines. http: ssl_certificate: /ssl/fullchain.pem ssl_key: /ssl/privkey.pem Click Save. Click Developer Tools, and check config. If there are any errors correct them â If all is well click Restart. Next forward forward a port in your router to allow traffic through so that you can access your Home Assistant instance from the Internet. Go to your router IP address.
When you go back to Home Assistant, eg http://homeassistant-local:8123 you will get an error. This is because youâve turned on SSL, so we need to change the URL slightly to use https instead of http, ie https://homeassistant-local:8123 Once you do this, youâll get a warning that your connection is not private as weâre using the IP address. It is safe to ignore this as this is inside your network. Click Advanced, and then the Proceed link. Home Assistant will now display and you can use this as normal. From a browser outside the home network, enter your DuckDNS url that you set up, ensuring you precede this with https:. eg https://mydomain.duckdns You do not need port 8123 Log in using your normal credentials. Once logged in, you can then operate home assistant as if you were browsing from your home network. You can use the remote access domain eg https://mydomain.duckdns even within your home network so you do not need to use the local IP address. Warning: as local access now requires https, theHone assistant Voice Preview dition may not be able to connect as it requires http access - slychiu - 05-19-2025 Hereâs how to set up local HTTP access for Home Assistant OS while keeping DuckDNS and Let\'s Encrypt for external HTTPS access (I have not tested this) You\'ll typically be using two key add-ons:
Step 1: Ensure DuckDNS and Let\'s Encrypt Add-ons are Correctly Configured
This is the crucial step to tell Home Assistant to trust the Nginx proxy and allow HTTP connections from it.
use_x_forwarded_for: true trusted_proxies: - 172.30.33.0/24 # This is the default Docker network for Home Assistant OS add-ons ip_ban_enabled: true # Optional, but recommended login_attempts_threshold: 5 # Optional, but recommended # IMPORTANT: If your Nginx add-on is handling SSL, REMOVE or COMMENT OUT the following lines: # ssl_certificate: /ssl/fullchain.pem # ssl_key: /ssl/privkey.pem use_x_forwarded_for: true: This tells Home Assistant to look at the X-Forwarded-For header set by the Nginx proxy to get the true client IP address.trusted_proxies:
Step 3: Configure Your Nginx Add-on
Okay, great! Using Home Assistant OS makes this process quite streamlined as it relies heavily on add-ons for these functionalities. |