Appdeamon continually disconnects from HA

I recently switched from HA ssl to using nginx. I noticed last night that my appdaemon script hadn’t run as expected. I checked the logs and saw that appdaemon was no longer connecting to HA. Duh. I forgot to update my config. So I changed my ha_url to refelect my local address. If i add the port to the url appdaemon won’t connect at all. Also plugging the IP into a browser always redirects to my duckdns address.

config:

[AppDaemon]
ha_url = http://192.168.1.223
ha_key = my_key
logfile = /home/homeassistant/.homeassistant/appdaemon/logs/logfile.log
errorfile = /home/homeassistant/.homeassistant/appdaemon/logs/errorfile.log
app_dir = /home/homeassistant/.homeassistant/appdaemon/apps
threads = 10

# Apps
[hello_world]
module = hello
class = HelloWorld

[auto_lock]
module = auto_lock
class = LockMonitor
ttl = 600

Now I get the following like every 7 seconds.

2017-03-19 09:01:34.493511 INFO Got initial state
2017-03-19 09:01:36.498003 INFO Reloading Module: /home/homeassistant/.homeassistant/appdaemon/apps/lrlampon.py
2017-03-19 09:01:36.500319 INFO Reloading Module: /home/homeassistant/.homeassistant/appdaemon/apps/hello.py
2017-03-19 09:01:36.502579 INFO Loading Object hello_world using class HelloWorld from module hello
2017-03-19 09:01:36.505593 INFO hello_world: Hello from AppDaemon
2017-03-19 09:01:36.508228 INFO hello_world: You are now ready to run Apps!
2017-03-19 09:01:36.508933 INFO Reloading Module: /home/homeassistant/.homeassistant/appdaemon/apps/auto_lock.py
2017-03-19 09:01:36.511270 INFO Loading Object auto_lock using class LockMonitor from module auto_lock
2017-03-19 09:01:36.512257 INFO App initialization complete
2017-03-19 09:01:36.516261 WARNING Disconnected from Home Assistant, retrying in 5 seconds
2017-03-19 09:01:41.705701 INFO Got initial state
2017-03-19 09:01:43.711792 INFO Reloading Module: /home/homeassistant/.homeassistant/appdaemon/apps/lrlampon.py
2017-03-19 09:01:43.715975 INFO Reloading Module: /home/homeassistant/.homeassistant/appdaemon/apps/hello.py
2017-03-19 09:01:43.720005 INFO Loading Object hello_world using class HelloWorld from module hello
2017-03-19 09:01:43.725568 INFO hello_world: Hello from AppDaemon
2017-03-19 09:01:43.730840 INFO hello_world: You are now ready to run Apps!
2017-03-19 09:01:43.732039 INFO Reloading Module: /home/homeassistant/.homeassistant/appdaemon/apps/auto_lock.py
2017-03-19 09:01:43.736356 INFO Loading Object auto_lock using class LockMonitor from module auto_lock
2017-03-19 09:01:43.738033 INFO App initialization complete
2017-03-19 09:01:43.745296 WARNING Disconnected from Home Assistant, retrying in 5 seconds
2017-03-19 09:01:48.970559 INFO Got initial state
2017-03-19 09:01:50.975146 INFO Reloading Module: /home/homeassistant/.homeassistant/appdaemon/apps/lrlampon.py
2017-03-19 09:01:50.977563 INFO Reloading Module: /home/homeassistant/.homeassistant/appdaemon/apps/hello.py
2017-03-19 09:01:50.979832 INFO Loading Object hello_world using class HelloWorld from module hello
2017-03-19 09:01:50.982994 INFO hello_world: Hello from AppDaemon
2017-03-19 09:01:50.985659 INFO hello_world: You are now ready to run Apps!
2017-03-19 09:01:50.986391 INFO Reloading Module: /home/homeassistant/.homeassistant/appdaemon/apps/auto_lock.py
2017-03-19 09:01:50.988755 INFO Loading Object auto_lock using class LockMonitor from module auto_lock
2017-03-19 09:01:50.989746 INFO App initialization complete
2017-03-19 09:01:50.993728 WARNING Disconnected from Home Assistant, retrying in 5 seconds

Cheers,
Mike

I figured it out.

I had added this line to my config based on the link below, after removing it everything is working now.

http:
  server_host: 127.0.0.1
1 Like

You will need the port unles it is running on port 80.

Try starting AppDaemon with -D DEBUG after you make that change to get a more informative error.

EDIT: You beat me to it, glad it is working now!