This week, I discovered that an automatic upgrade to v0.15 of AppDaemon did not go as planned. When I went to bed on Wednesday, I found the screen on the Sonoff NSPanel in our bedroom was still on and was reporting a time of ~16:00.

There were a few problems with this:

  1. It was 22:45, and not ~16:00
  2. The Sonoff NSPanel should turn the screen off automatically from 21:00
  3. The panel was entirely unresponsive

The Problem

I checked AppDaemon, within Home Assistant, and it wasn't running. Instead, the logs were reporting the following error:

s6-rc: info: service init-appdaemon successfully started
s6-rc: info: service appdaemon: starting
s6-rc: info: service appdaemon successfully started
s6-rc: info: service legacy-services: starting
[10:14:56] INFO: Starting AppDaemon...
s6-rc: info: service legacy-services successfully started
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/__main__.py", line 417, in main
ERROR Error loading secrets file: /config/secrets.yaml
    admain.main()
  File "/usr/lib/python3.11/site-packages/appdaemon/__main__.py", line 276, in main
    if "appdaemon" not in config:
       ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable
[10:14:58] INFO: Service AppDaemon exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service appdaemon: stopping
s6-rc: info: service appdaemon successfully stopped
s6-rc: info: service init-appdaemon: stopping
s6-rc: info: service init-appdaemon successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

The first thing I did was check the state of the appdaemon folder within config, but the folder was empty 😟.

This is not good... I use AppDaemon for quite a few automations.

The Solution

It turns out two things have happened in this upgrade:

Firstly, appdaemon has been migrated out of config to live within /addon_configs:

appdaemon now lives in the addon_configs folder

This was a relief, as it turns out I haven't lost all of my AppDaemon config 😌. Fortunately, I have a responsibly comprehensive set of backups after the SD card on my Raspberry Pi failed, and I migrated it to a NUC.

The root cause of this problem is that the appdaemon.yaml file will be referencing:

secrets: /config/secrets.yaml

Which instead needs to be

secrets: /homeassistant/secrets.yaml

With this corrected within the configuration files, I can now start AppDaemon again!

Home Assistant running AppDaemon v0.15.2