AppDaemon Dies when Internet Dies

I have HASSIO, DuckDNS, Let’s Encrypt and AppDaemon setup. It runs great, but last night my internet died and AppDaemon was not able to resolve my DuckDNS domain so all my automations died with it.

I have tried using https://192.168.1.xx:8123 in the ha_url config value and it won’t connect. I have also tried setting cert_verify = False and that made AppDaemon to restart in an infinite loop. What do I need to do to make it not reliant on an internet connection?

My appdaemon.yaml config:

AppDaemon:
  logfile: /config/appdaemon/logappdaemon.log
  errorfile: /config/appdaemon/error.log
  threads: 10
HASS:
  ha_url: https://my.duckdns.org
  ha_key: 
HADashboard:
  dash_url: http://192.168.x.x:5050

Using your duckdns url it will ALWAYS rely on internet - you’ll want to figure out the local IP and use it. You may need the ha_key if you haven’t added it in the appdaemon config.

I was able to figure it out thanks to ReneTode’s post. I had to install nginx proxy and certbot add ons to get it working.

Instructions for anyone else stumbling on this:

  1. Port forward port 80 & 443 to your HASSIO host.
  2. Add https://github.com/bestlibre/hassio-addons to the hass io add-on repository
  3. Install nginx proxy and certbot
  4. Edit the config for both add ons using your duckdns domain. Don’t use certfile for nginx yet just yet.
  5. Start nginx and then start certbot. It’ll get the SSL certificate for you.
  6. Edit nginx proxy to use the newly created certificate with the “certname”: “whatever-name-for-your-cert-in-certbot” for your domain.
  7. Restart nginx.
  8. Remove SSL from HA’s configuration.yaml if you have it and restart.
  9. Edit appdaemon.yaml to point ha_url to HASSIO’s http://localip:8123

You should now be able to login to your HA via https using your DuckDNS domain and AppDaemon will be able to connect using the local ip w/o SSL.

For what it’s worth, I made some changes in AD 3.0 today that will enable you to use the cert_validate=False workaround for the above which should give other folks some more options.

This particular change will be in AD 3.0 beta 2.

1 Like