Community Hass.io Add-on: AppDaemon 3

I’m having a problem creating a custom skin. I’ve read through the documentation several times. The issues I’m having is with anything placed in the custom_css folder as what was to be created to store the skin folder and files.
The docs show, when adding a custom image use the following path
/custom_css/<skin name>/<image directory>/<image filename>
Which I’ve done for my image, and confirmed the folder path via filezilla.
Here’s the path and file used in my dashboard.css file
background-image: url("/custom_css/Fresh/img/dancer.jpg");

The same issue is happening when I try to do a head include in the variables.yaml. I’m trying to add a custom js script but when viewing the page and skin using web dev tools, the console is showing that there was a problem loading the script which is because it can’t find it.

I checked the read/write/execute permissions of the custom_css folder and sub folder contents of that directory but I still can’t figure out why I can’t render the image without getting a 404 not found error.

Nor can I figure out the proper place to put the js file so that I can add the following into my variables.yaml file.
head_includes:
- <script type="text/javascript" src="custom_css/Fresh/zoots_init2.js"></script>

Any help would be greatly appreciated, I’ve been playing with this file path for hours.

the url from your background image is the same that i use.

.gridster {
  margin: 0px auto;
  background-image: url(/custom_css/lighttransparant/img/zeegezicht2.jpg);
}

so the location is right,
you can use the google chrome console to debug, and you can add the accessfile to your appdaemon.yaml to get more debugging information (configuration in docs)

lots of times in such cases its a fileright, or a typo (case sensitive)

the js file you can place anywhere you like inside the custom_css dir (and you can create a complete structure there)
you can for instance create custom_css/html/js and use
/custom_css/html/js/zoots_init2.js

are the files owned by the right user?

The owner of the files according to Filezilla is root. But the permissions on the folder and files are set to Read by Group and Public.
I haven’t modified the appdaemon.yaml file, I’ll check the docs and see what info is there regarding that.
I did confirm there is no typo in the path. I’m dumbfounded at this point as to why I can’t get to those folders or rather have the content render.

2019-01-19_16-48-45

then there is your trouble.
you can be assured that you dont run appdaemon as root. so appdaemon has no access to that file.
make sure that the user that starts appdaemon (most likely homeassistant) is the owners of all files in the appdaemon config file, and your problems are gone.

(just about the cause of the problems: you probably use samba or any other kind of program to read and create files. and with that programm you login as root, change that to avoid such trouble in the future, or be aware of it every time and change ownership from every file you create)

Thanks for the quick response, but that doesn’t seem to be the issue. Even when I use Home Assistant to upload the image directly to the folder logged in as my HA admin, it still shows the “owner” as root in Filezilla, and still get the 404 Error. I was sooooo hoping that was the issue =) But still at a loss

Wait, I’m making headway. No matter how many times I restarted Home Assistant nothing changed, I finally decided to restart JUST APPDEAMON and I’m now seeing the background.

HI,

I get this… any idea?

19-01-24 11:32:15 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token 19-01-24 11:35:20 ERROR (SyncWorker_0) [hassio.docker] Can’t create container from addon_a0d7b954_appdaemon3: 409 Client Error: Conflict (“Conflict. The container name “/addon_a0d7b954_appdaemon3” is already in use by container “d26297c943f7d05d79fe2b982f484925c89f40c387231e9f93da18730ba58804”. You have to remove (or rename) that container to be able to reuse that name.”) 19-01-24 11:41:53 WARNING (MainThread) [hassio.api.addons] Protected flag changing for a0d7b954_appdaemon3! 19-01-24 11:42:08 WARNING (MainThread) [hassio.api.addons] Protected flag changing for a0d7b954_appdaemon3! 19-01-24 11:42:10 WARNING (MainThread) [hassio.api.addons] Protected flag changing for a0d7b954_appdaemon3! 19-01-24 11:42:11 WARNING (SyncWorker_19) [hassio.docker.addon] AppDaemon run with disabled protected mode! 19-01-24 11:42:11 ERROR (SyncWorker_19) [hassio.docker] Can’t create container from addon_a0d7b954_appdaemon3: 409 Client Error: Conflict (“Conflict. The container name “/addon_a0d7b954_appdaemon3” is already in use by container “d26297c943f7d05d79fe2b982f484925c89f40c387231e9f93da18730ba58804”. You have to remove (or rename) that container to be able to reuse that name.”) 19-01-24 11:43:26 WARNING (MainThread) [hassio.api.addons] Protected flag changing for a0d7b954_appdaemon3! 19-01-24 11:43:57 INFO (SyncWorker_0) [hassio.docker.interface] Remove Docker hassioaddons/appdaemon3-armhf with latest and None 19-01-24 11:43:57 INFO (MainThread) [hassio.addons.addon] Remove Home Assistant add-on data folder /data/addons/data/a0d7b954_appdaemon3 19-01-24 11:44:28 INFO (MainThread) [hassio.homeassistant] Update Home Assistant to version 0.86.0 19-01-24 11:44:28 INFO (SyncWorker_1) [hassio.docker.interface] Update Docker 0.85.1 with homeassistant/raspberrypi3-homeassistant:0.86.0 19-01-24 11:44:28 INFO (SyncWorker_1) [hassio.docker.interface] Pull image homeassistant/raspberrypi3-homeassistant tag 0.86.0. 19-01-24 11:47:12 INFO (SyncWorker_1) [hassio.docker.interface] Tag image homeassistant/raspberrypi3-homeassistant with version 0.86.0 as latest 19-01-24 11:47:12 INFO (SyncWorker_1) [hassio.docker.interface] Stop homeassistant/raspberrypi3-homeassistant Docker application 19-01-24 11:47:43 INFO (SyncWorker_1) [hassio.docker.interface] Clean homeassistant/raspberrypi3-homeassistant Docker application 19-01-24 11:47:43 INFO (SyncWorker_1) [hassio.docker.interface] Cleanup Docker images: [‘homeassistant/raspberrypi3-homeassistant:0.85.1’] 19-01-24 11:47:53 INFO (SyncWorker_14) [hassio.docker.homeassistant] Start homeassistant homeassistant/raspberrypi3-homeassistant with version 0.86.0 19-01-24 11:49:04 INFO (MainThread) [hassio.homeassistant] Detect a running Home Assistant instance 19-01-24 11:49:04 INFO (MainThread) [hassio.homeassistant] Successful run Home Assistant 0.86.0 19-01-24 11:54:48 INFO (MainThread) [hassio.addons.addon] Create Home Assistant add-on data folder /data/addons/data/a0d7b954_appdaemon3 19-01-24 11:54:48 INFO (SyncWorker_18) [hassio.docker.interface] Pull image hassioaddons/appdaemon3-armhf tag 1.6.0. 19-01-24 11:54:48 ERROR (MainThread) [hassio.utils] Can’t execute install while a task is in progress 19-01-24 11:54:50 ERROR (SyncWorker_18) [hassio.docker.interface] Can’t install hassioaddons/appdaemon3-armhf:1.6.0 -> 500 Server Error: Internal Server Error (“readlink /var/lib/docker/overlay2: invalid argument”). 19-01-24 11:55:00 INFO (SyncWorker_7) [hassio.docker.interface] Pull image hassioaddons/appdaemon3-armhf tag 1.6.0. 19-01-24 11:55:01 ERROR (SyncWorker_7) [hassio.docker.interface] Can’t install hassioaddons/appdaemon3-armhf:1.6.0 -> 500 Server Error: Internal Server Error (“readlink /var/lib/docker/overlay2: invalid argument”). 19-01-24 11:56:50 INFO (SyncWorker_1) [hassio.docker.interface] Clean homeassistant/armhf-addon-check_config Docker application 19-01-24 11:56:55 INFO (SyncWorker_1) [hassio.docker.addon] Start Docker add-on homeassistant/armhf-addon-check_config with version 0.9

seems to me that you installed appdaemon twice

How to fix it, now it is shown as not installed… and I can not install it… ;-(

im sorry, but i have no idea.
maybe you did uninstall it before and that went wrong, or you installed another addon with the same name, or some update went wrong.

i think your best bet is to search and/or ask in the hassio section for others that have had simular things with addons.

After restart I get:

19-01-24 14:01:15 ERROR (SyncWorker_9) [hassio.docker.interface] Can’t install hassioaddons/appdaemon3-armhf:1.6.0 -> 500 Server Error: Internal Server Error (“readlink /var/lib/docker/overlay2: invalid argument”).

Hi,

I recently upgraded to 0.86.3. After the update I can not start appdeamon 3.x to run HAdashboard.

I get the following error:

Can’t create container from addon_a0d7b954_appdaemon3: 500 Server Error: Internal Server Error (“stat /var/lib/docker/overlay2/xxx-init/merged/etc/hosts: structure needs cleaning”)

(at the xxx there is a long code of numbers and letters, which I replaced for xxx)

I installed the add-on, rebooted, and reinstall, but the add-on won’t start.

Hope someone knows how to solve this!

Hi @frenck,

I noticed the following behavior; does this sound familiar? Any way to ‘fix’ this?

Problem: AppDaemon does not handle Hassio events after:

  • Restart Hassio (e.g. via SSH or web interface)
  • Restart of host (e.g. via SSH or web interface)

Workaround:

  • Manually restart appdaemon (e.g. via web interface)
  • Make a change in one of the appdaemon programs and/or yaml (forces appdaemon reload)

In practice this means that after a restart of HASSIO you have to manually restart appdaemon in order to be able to make use of the applications. Very annoying…

When you say AppDaemon doesn’t handle Hassio events after a restart of Hassio, are you referring to restarting Home Assistant through the Configuration menu? If so, I’ve never had a problem with this. I haven’t had to restart the host so I can’t speak to that.

What does your AppDaemon log show after a Home Assistant restart?

Yes, I’m referring to restarting via the config menu. The AppDaemon log shows no change after the reboot (e.g. via config menu); existing logging is still there and no new logging is added.

That’s strange, there should be an indication there that it lost the connection with Home Assistant. What does your add-on configuration look like?

Yes, strange indeed. This is my config:

secrets: /config/secrets.yaml
log:
  logfile: STDOUT
  errorfile: STDERR
appdaemon:
  threads: 10
  app_dir: /config/appdaemon/apps
  plugins:
    HASS:
      type: hass
      ha_url: http://hassio/homeassistant
      token: mytoken
hadashboard:
  dash_url: http://127.0.0.1:5050
  dash_dir: /config/appdaemon/dashboards

change STDOUT and STDERR to a valid filename, so that you can find out what is going on.

i dont know if addons are restarted when you restart homeassistant, but appdaemon normally goes on and something in your apps can cause trouble when it cant reach homeassistant.

some thing with complete device restart. you could have a race problem.
but that can only been seen with good logfiles.

Done:)

After a cold boot (hassio host restart) the below is logged. The error log remains empty (no errors). The apps however are not working.

AppDaemon log in logfile:

2019-02-18 21:43:07.823321 INFO AppDaemon Version 3.0.2 starting
2019-02-18 21:43:07.824786 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-02-18 21:43:07.832515 INFO AppDaemon: Starting Apps
2019-02-18 21:43:07.850015 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-02-18 21:43:08.705671 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-02-18 21:43:08.707137 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-02-18 21:43:08.708196 INFO Starting Dashboards
2019-02-18 21:43:08.747830 INFO API is disabled
2019-02-18 21:43:08.767640 INFO AppDaemon: HASS: Connected to Home Assistant 0.87.1
2019-02-18 21:43:09.999860 INFO AppDaemon: Got initial state from namespace default
2019-02-18 21:43:13.040011 INFO AppDaemon: Reading config
2019-02-18 21:43:13.403917 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-02-18 21:43:13.405348 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-02-18 21:43:13.406486 INFO AppDaemon: App 'app_carport_motion' added
2019-02-18 21:43:13.408341 INFO AppDaemon: App 'app_carport_motion2' added
2019-02-18 21:43:13.409502 INFO AppDaemon: App 'door_notifications' added
2019-02-18 21:43:13.411083 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-02-18 21:43:13.414811 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/door_notifications.py
2019-02-18 21:43:14.303290 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/carport_motion.py
2019-02-18 21:43:14.315312 INFO AppDaemon: Initializing app app_carport_motion using class carport_motion_detection from module carport_motion
2019-02-18 21:43:14.701466 INFO app_carport_motion: Initializing carport_motion_detection stuff
2019-02-18 21:43:14.703335 INFO AppDaemon: Initializing app app_carport_motion2 using class carport_motion_detection from module carport_motion
2019-02-18 21:43:14.712214 INFO app_carport_motion2: Initializing carport_motion_detection stuff
2019-02-18 21:43:14.719877 INFO AppDaemon: Initializing app door_notifications using class DoorMonitor from module door_notifications
2019-02-18 21:43:14.722388 INFO AppDaemon: App initialization complete

AppDaemon log in add-on page:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: AppDaemon v1.6.0
 Python Apps and HADashboard using AppDaemon 3.x for Home Assistant
 From: Community Hass.io Add-ons
 By: Franck Nijhof <[email protected]>
-----------------------------------------------------------
 armhf / HassOS 1.13 / HA 0.87.1 / SU 143 / stable
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing... 
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 20-init-configuration.sh: executing... 
[cont-init.d] 20-init-configuration.sh: exited 0.
[cont-init.d] 21-compiled-dir.sh: executing... 
[cont-init.d] 21-compiled-dir.sh: exited 0.
[cont-init.d] 30-auto-token.sh: executing... 
INFO: Updating Hass.io API token in AppDaemon with the current one...
[cont-init.d] 30-auto-token.sh: exited 0.
[cont-init.d] 31-ha-url.sh: executing... 
[cont-init.d] 31-ha-url.sh: exited 0.
[cont-init.d] 50-compiled-symlink.sh: executing... 
[cont-init.d] 50-compiled-symlink.sh: exited 0.
[cont-init.d] 80-system-packages.sh: executing... 
[cont-init.d] 80-system-packages.sh: exited 0.
[cont-init.d] 81-python-packages.sh: executing... 
[cont-init.d] 81-python-packages.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

After restarting the AppDaemon via the add-on page, the logging is as below.

Log file is appended with the following:

2019-02-18 21:51:06.778124 INFO SIGTERM Recieved
2019-02-18 21:51:06.794719 INFO AppDaemon: HASS: Disconnecting from Home Assistant
2019-02-18 21:51:06.962800 INFO AppDaemon: Removing module /config/appdaemon/apps/door_notifications.py
2019-02-18 21:51:06.970221 INFO AppDaemon: Removing module /config/appdaemon/apps/carport_motion.py
2019-02-18 21:51:06.972342 INFO AppDaemon: Terminating app_carport_motion
2019-02-18 21:51:06.973852 INFO AppDaemon: Terminating app_carport_motion2
2019-02-18 21:51:06.975236 INFO AppDaemon: Terminating door_notifications
2019-02-18 21:51:06.988703 INFO AppDeamon Exited
2019-02-18 21:52:07.774674 INFO AppDaemon Version 3.0.2 starting
2019-02-18 21:52:07.776308 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-02-18 21:52:07.783606 INFO AppDaemon: Starting Apps
2019-02-18 21:52:07.802279 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-02-18 21:52:08.414273 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-02-18 21:52:08.416745 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-02-18 21:52:08.418636 INFO Starting Dashboards
2019-02-18 21:52:08.463184 INFO API is disabled
2019-02-18 21:52:08.505998 INFO AppDaemon: HASS: Connected to Home Assistant 0.87.1
2019-02-18 21:52:10.260703 INFO AppDaemon: Got initial state from namespace default
2019-02-18 21:52:12.032155 INFO AppDaemon: Reading config
2019-02-18 21:52:12.107774 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-02-18 21:52:12.109085 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-02-18 21:52:12.110050 INFO AppDaemon: App 'app_carport_motion' added
2019-02-18 21:52:12.111234 INFO AppDaemon: App 'app_carport_motion2' added
2019-02-18 21:52:12.112164 INFO AppDaemon: App 'door_notifications' added
2019-02-18 21:52:12.114418 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-02-18 21:52:12.118232 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/door_notifications.py
2019-02-18 21:52:12.202106 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/carport_motion.py
2019-02-18 21:52:12.206992 INFO AppDaemon: Initializing app app_carport_motion using class carport_motion_detection from module carport_motion
2019-02-18 21:52:12.659889 INFO app_carport_motion: Initializing carport_motion_detection stuff
2019-02-18 21:52:12.661189 INFO AppDaemon: Initializing app app_carport_motion2 using class carport_motion_detection from module carport_motion
2019-02-18 21:52:12.665794 INFO app_carport_motion2: Initializing carport_motion_detection stuff
2019-02-18 21:52:12.666780 INFO AppDaemon: Initializing app door_notifications using class DoorMonitor from module door_notifications
2019-02-18 21:52:12.669227 INFO AppDaemon: App initialization complete

AppDaemon log

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: AppDaemon v1.6.0
 Python Apps and HADashboard using AppDaemon 3.x for Home Assistant
 From: Community Hass.io Add-ons
 By: Franck Nijhof <[email protected]>
-----------------------------------------------------------
 armhf / HassOS 1.13 / HA 0.87.1 / SU 143 / stable
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing... 
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 20-init-configuration.sh: executing... 
[cont-init.d] 20-init-configuration.sh: exited 0.
[cont-init.d] 21-compiled-dir.sh: executing... 
[cont-init.d] 21-compiled-dir.sh: exited 0.
[cont-init.d] 30-auto-token.sh: executing... 
INFO: Updating Hass.io API token in AppDaemon with the current one...
[cont-init.d] 30-auto-token.sh: exited 0.
[cont-init.d] 31-ha-url.sh: executing... 
[cont-init.d] 31-ha-url.sh: exited 0.
[cont-init.d] 50-compiled-symlink.sh: executing... 
[cont-init.d] 50-compiled-symlink.sh: exited 0.
[cont-init.d] 80-system-packages.sh: executing... 
[cont-init.d] 80-system-packages.sh: exited 0.
[cont-init.d] 81-python-packages.sh: executing... 
[cont-init.d] 81-python-packages.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

Now the Apps work again and I get the following in my log to confirm:

2019-02-18 21:54:31.156854 INFO app_carport_motion2: Jeej, it's dark and the motion app called by input_boolean.virtual_carport_motion
2019-02-18 21:54:31.160757 INFO app_carport_motion2: Light status before motion is dimmed restoring lights after motion

what kind of app are that?
do they connect to anything?

it is very well possible that you start a service in your apps that needs to be terminated, before AD closes.
from the logs it shows that everything should be working correct.