AppDaemon does not load apps

Hi

I’m new here, so sorry if this is a dumb question.

I’ve setup home assistant and am trying to setup appdaemon in docker. It loads without errors but does not pickup any apps - not even hello.py:

2019-01-04 13:26:25.245700 INFO AppDaemon Version 3.0.2 starting
2019-01-04 13:26:25.246987 INFO Configuration read from: /conf/appdaemon.yaml
2019-01-04 13:26:25.247315 DEBUG AppDaemon Section: None
2019-01-04 13:26:25.247685 DEBUG HADashboard Section: None
2019-01-04 13:26:25.252303 INFO AppDaemon: Starting Apps
2019-01-04 13:26:25.254078 DEBUG AppDaemon: Creating worker threads ...
2019-01-04 13:26:25.261262 DEBUG AppDaemon: Done
2019-01-04 13:26:25.261889 DEBUG AppDaemon: Entering run()
2019-01-04 13:26:25.262461 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-01-04 13:26:25.418977 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-01-04 13:26:25.420022 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-01-04 13:26:25.420545 DEBUG AppDaemon: Starting utility loop
2019-01-04 13:26:25.420877 INFO Starting Dashboards
2019-01-04 13:26:25.431857 INFO API is disabled
2019-01-04 13:26:25.432369 DEBUG Start Loop

My appdaemon.yaml:

log:
  logfile: /conf/out.log
  errorfile: /conf/err.log

appdaemon:
  threads: 10
  app_dir: /conf/apps
  plugins:
    HASS:
      type: hass
      ha_url: https://10.0.0.13:8123
      token: xxx
      cert_path: /certs/certificate.pem
      cert_verify: true

hadashboard:
    dash_url: http://10.0.0.13:5050

what can I do?

do you have /conf/apps created?
does appdaemon have reading and writing rights there?
do you have any apps (a py file accompanied by a yaml file in that directory?
is there anything in your error log?

Hi,

Yes, /conf/apps was created by docker on initialization. there is a hello.py app and an apps.yaml with the following:

hello.py
import appdaemon.plugins.hass.hassapi as hass
#
# Hellow World App
#
# Args:
#

class HelloWorld(hass.Hass):

  def initialize(self):
     self.log("Hello from AppDaemon")
     self.log("You are now ready to run Apps!") 

apps.yaml:
hello_world:
module: hello
class: HelloWorld

Nothing else in my error log, except that it looses connection to HA once in a while:
2019-01-04 14:51:01.056324 INFO AppDaemon Version 3.0.2 starting
2019-01-04 14:51:01.057040 INFO Configuration read from: /conf/appdaemon.yaml
2019-01-04 14:51:01.057285 DEBUG AppDaemon Section: None
2019-01-04 14:51:01.057488 DEBUG HADashboard Section: None
2019-01-04 14:51:01.062676 DEBUG AppDaemon: Creating worker threads …
2019-01-04 14:51:01.067902 DEBUG AppDaemon: Done
2019-01-04 14:51:01.068369 DEBUG AppDaemon: Entering run()
2019-01-04 14:51:01.068990 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-01-04 14:51:01.188044 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-01-04 14:51:01.189118 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-01-04 14:51:01.189665 DEBUG AppDaemon: Starting utility loop
2019-01-04 14:51:01.189999 INFO Dashboards are disabled
2019-01-04 14:51:01.190215 INFO API is disabled
2019-01-04 14:51:01.190435 DEBUG Start Loop
2019-01-04 14:53:11.432416 DEBUG AppDaemon: Event type:ha_disconnected:
2019-01-04 14:53:11.433081 DEBUG AppDaemon: {}
2019-01-04 14:53:11.433412 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2019-01-04 14:53:11.433625 WARNING AppDaemon: HASS: ------------------------------------------------------------
2019-01-04 14:53:11.433826 WARNING AppDaemon: HASS: Unexpected error:
2019-01-04 14:53:11.434070 WARNING AppDaemon: HASS: ------------------------------------------------------------
2019-01-04 14:53:11.436419 WARNING AppDaemon: HASS: Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/appdaemon/plugins/hass/hassplugin.py”, line 152, in get_updates
“{}/api/websocket”.format(url), sslopt=sslopt
File “/usr/local/lib/python3.6/site-packages/websocket/_core.py”, line 511, in create_connection
websock.connect(url, **options)
File “/usr/local/lib/python3.6/site-packages/websocket/_core.py”, line 220, in connect
options.pop(‘socket’, None))
File “/usr/local/lib/python3.6/site-packages/websocket/_http.py”, line 120, in connect
sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
File “/usr/local/lib/python3.6/site-packages/websocket/_http.py”, line 186, in _open_socket
raise error
File “/usr/local/lib/python3.6/site-packages/websocket/_http.py”, line 170, in _open_socket
sock.connect(address)
TimeoutError: [Errno 110] Connection timed out

2019-01-04 14:53:11.436834 WARNING AppDaemon: HASS: ------------------------------------------------------------

please always use codeblocks for logs, and code and yaml, or its impossible to help in a good way.

the info you shared now is much more helpfull because it shows that appdaemon doesnt start correctly.

if you use the url https://10.0.0.13:8123 in a browser, does it corect connect to HASS?
i guess you have SSL certification setup in HA, did you tell your docker file where to look for /certs ?

Yes, the url works perfectly from the browser. Certificates are mounted in docker. I’ve tried setting cert_verify to false but it does not seem to change anytning

if you have setup certs in HA then you need cert verify.

why do you have ssl for local connection?
normally ssl is combined with an outside DNS (duckdns)
but if you have both in HA you cant use local ip anymore

or the outside connection is through a proxyserver (nginx, caddy) and then ssl and duckdns are setup in there and not in HASS.

the best way to connect from AD to hass is with local ip without ssl (no ssl in hass setup)

did you connect the ips in docker?

you say that /conf/apps was created by docker?
did you use the acockburn docker version?
and follow the official docs?

https://appdaemon.readthedocs.io/en/latest/DOCKER_TUTORIAL.html

Thanks for the pointers. I turned off certs and will setup nginx reverse proxy.

The deal breaker turned out to be some side effects of docker dynamically updating iptables rules combined with how docker appears as source and destination for traffic. Solution was to accept traffic from anywhere to anywhere on INPUT for TCP traffic to port 8123.

1 Like

i have no clue about docker, i never used it, but im glad you worked it out.