Appdaemon 3 docker

I am having problems with Appdeamon V3, This is the fourth thing to get going now (Homeassistant,Node-red,MQTT) on my NUC Ubuntu 16.04 Docker setup.

My Folder are home/cameron/docker/appdaemon/logs.

Here is the Appdaemon part of the docker_compose.yaml file.

  appdaemon:
    container_name: appdaemon
    restart: always
    image: acockburn/appdaemon:latest
    volumes:
      - /home/cameron/docker/appdaemon:/conf
      - /etc/localtime:/etc/localtime:ro
    environment:
      - HA_URL="http://192.168.85.5:8123"
      - HA_KEY="mypass"
      - DASH_URL="http://192.168.85.5:5050"
    ports:
      - "5050:5050"
    network_mode: host

And the Appdaemon.yaml file.

appdaemon:
  time_zone: GMT+0BST-1,M3.5.0
  disable_apps: 0
  threads: 10 
  app_dir: /conf/apps  
  plugins:
    HASS:
      type: hass
      ha_url: "http://192.168.85.5:8123"
      ha_key: "mypass"

log:
  accessfile: /conf/logs/access.log
  errorfile: /conf/logs/error.log
  logfile: /conf/logs/appdaemon.log
  log_generations: 3
  log_size: 100000

hadashboard:
  dash_url: "http://192.168.85.5:5050"
  dashboard_dir: /conf/dashboards

And the error i get from Appdaemon in the Portainer logs.

cp: cannot stat ‘/usr/src/app/conf/apps.yaml.example’: No such file or directory
Traceback (most recent call last):
  File "/usr/local/bin/appdaemon", line 11, in <module>
    load_entry_point('appdaemon==3.0.0', 'console_scripts', 'appdaemon')()
  File "/usr/local/lib/python3.6/site-packages/appdaemon/admain.py", line 365, in main
    admain.main()
  File "/usr/local/lib/python3.6/site-packages/appdaemon/admain.py", line 361, in main
    self.run(appdaemon, hadashboard)
  File "/usr/local/lib/python3.6/site-packages/appdaemon/admain.py", line 80, in run
    loop.run_until_complete(asyncio.gather(*pending))
  File "/usr/local/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 1332, in utility
    self.init_sun()
  File "/usr/local/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 866, in init_sun
    self.tz = pytz.timezone(self.time_zone)
  File "/usr/local/lib/python3.6/site-packages/pytz/__init__.py", line 180, in timezone
    raise UnknownTimeZoneError(zone)
pytz.exceptions.UnknownTimeZoneError: 'GMT+0BST-1,M3.5.0'

Any help on this.

AppDaemon uses pytz for timezone calculation and that is not a valid timezone for pytz.

This thread has some more info.

Hi Andrew

Thanks i changed that and it shows this error now…

cp: cannot stat ‘/usr/src/app/conf/apps.yaml.example’: No such file or directory

2018-03-21 18:57:41.505544 INFO AppDaemon Version 3.0.0 starting

2018-03-21 18:57:41.505871 INFO Configuration read from: /conf/appdaemon.yaml

2018-03-21 18:57:41.506912 INFO AppDaemon: Starting Apps

2018-03-21 18:57:41.514599 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin

2018-03-21 18:57:41.553328 INFO AppDaemon: HASS: HASS Plugin Initializing

2018-03-21 18:57:41.553825 INFO AppDaemon: HASS: HASS Plugin initialization complete

2018-03-21 18:57:41.554260 INFO Dashboards are disabled

2018-03-21 18:57:41.554458 INFO API is disabled

2018-03-21 18:57:41.555261 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds

2018-03-21 18:57:46.556903 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds

Any Thoughts

Try running with -D DEBUG so we can see the actual error that is causing this.

Sorry Andrew not sure how to that. I am a noob at docker stuff…

Try this:

http://appdaemon.readthedocs.io/en/latest/DOCKER_TUTORIAL.html#running-with-appdaemon-debug

Here is the error.

cameron@nuc:~$ docker run --rm -it -p 5050:5050 -v /home/cameron/docker/appdaemon:/conf -e EXTRA_CMD="-D DEBUG" acockburn/appdaemon:latest
cp: cannot stat ‘/usr/src/app/conf/apps.yaml.example’: No such file or directory
Traceback (most recent call last):
  File "/usr/local/bin/appdaemon", line 11, in <module>
    load_entry_point('appdaemon==3.0.0', 'console_scripts', 'appdaemon')()
  File "/usr/local/lib/python3.6/site-packages/appdaemon/admain.py", line 365, in main
    admain.main()
  File "/usr/local/lib/python3.6/site-packages/appdaemon/admain.py", line 279, in main
    fh = RotatingFileHandler(logfile, maxBytes=log_size, backupCount=log_generations)
  File "/usr/local/lib/python3.6/logging/handlers.py", line 150, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/local/lib/python3.6/logging/handlers.py", line 57, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/local/lib/python3.6/logging/__init__.py", line 1030, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/local/lib/python3.6/logging/__init__.py", line 1059, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/app/logs/appdaemon.log'

Does that base directory exist? “/apps/logs”?

I found an issue with the docker setup that is probably causing this.

If you give it a few minutes, then try running against the dev image instead of latest it should be fixed.

I have it working.

I changed this.

app_dir: /conf/apps to this app_dir: /conf

Thanks again

Edit and i deleted the network_mode: host

1 Like