Community Hass.io Add-on: AppDaemon 3

I have left my add-on with the standard log_level as info. When I in my apps add “self.log” then it gets into the log and I can see it on the Appdaemon add-on page. But isn’t it saved in a file somewhere? Issue is when I try to look back in time and then in the add-on page there is only so many records available - not enough historical data.

standaard goes the log to STDOUT and STDERR.
which are your systemlogs for output and error.

what you see on the addon page is a selection from the last lines in the systemlog that are about appdaemon.
but in the systemlogs you should be able to find way more.

how to get something from your systemlogs i dont know, because i always use seperate logs for everything. :wink:
but i think frenck can tell you that.

I am confused about the version. How does V1.6.0 relate to 3.0.2?

The first post suggests AppDaemn3 should be installed but I think that is old advice? A thread of 180 messages makes it tricky to find the latest advice.

Just checking as I tried installing (into a docker install) hass-apps using the requirements.txt method and it did not do anything.

V1.6.0 is the hassio addon version number
3.0.2 is the appdaemon version number

if you use docker then i suspect that you dont use hassio?
so then you dont have to do anything with hassio addons.

for docker install from appdaemon look at the documents.
https://appdaemon.readthedocs.io/en/latest/INSTALL.html

to know what version you have installed restart appdaemon and look in your logs.

1 Like

Thanks - see Heaty will die, Schedy be born!

Since few day my appdaemon stopped working, in the log I receive this

12-05 20:00:23 INFO (SyncWorker_15) [hassio.docker.interface] Clean hassioaddons/appdaemon3-amd64 Docker application
18-12-05 20:00:24 ERROR (SyncWorker_15) [hassio.docker] Can't start addon_a0d7b954_appdaemon3: 500 Server Error: Internal Server Error ("driver failed programming external connectivity on endpoint addon_a0d7b954_appdaemon3 (915c1a9c3ca1174c20188e4bace5279ead478a25e88ca02217554e7179588c43): Error starting userland proxy: listen tcp 0.0.0.0:5050: bind: address already in use")

which shows that port 5050 is in use (strange I don’t know what can that be). Nevertheless I changed port in configuration (5678), saved the configuration and started appdaemon addon, but it did not start, when I go see the log it gives same error: port 5050 in use, so I guess the addon does not pernmit to change the port??

i think you need a complete restart from your device.
probably with some restart from appdaemon or an update or something, something has kept running that should have been stopped.

Just trying to get AppDaemon add-on up and running, but getting problems in the log when I try to start it out of the box. I’m running hassio and I haven’t changed anything in the configuration. Here’s the snippet of the log, but nothing obvious stands out other than what seems like a problem in one of the dependent libraries…

2019-01-11 20:03:02.832595 INFO AppDaemon Version 3.0.2 starting
2019-01-11 20:03:02.833333 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-01-11 20:03:02.838535 INFO AppDaemon: Starting Apps
2019-01-11 20:03:02.847433 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-01-11 20:03:03.007927 WARNING AppDaemon: error loading plugin: HASS - ignoring
2019-01-11 20:03:03.008619 WARNING AppDaemon: ------------------------------------------------------------
2019-01-11 20:03:03.019954 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 304, in __init__
    mod = __import__(full_module_name, globals(), locals(), [module_name], 0)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassplugin.py", line 6, in <module>
    from sseclient import SSEClient
  File "/usr/lib/python3.6/site-packages/sseclient.py", line 8, in <module>
    import requests
  File "/usr/lib/python3.6/site-packages/requests/__init__.py", line 112, in <module>
    from . import utils
  File "/usr/lib/python3.6/site-packages/requests/utils.py", line 24, in <module>
    from . import certs
  File "/usr/lib/python3.6/site-packages/requests/certs.py", line 15, in <module>
    from certifi import where
  File "/usr/lib/python3.6/site-packages/certifi/__init__.py", line 1, in <module>
    from .core import where, old_where
  File "/usr/lib/python3.6/site-packages/certifi/core.py", line 3
    def test_binary_decode_autodtype(self):
    ^
IndentationError: unexpected indent
2019-01-11 20:03:03.020528 WARNING AppDaemon: ------------------------------------------------------------
2019-01-11 20:03:03.022122 INFO Starting Dashboards
2019-01-11 20:03:03.046189 INFO API is disabled
2019-01-11 20:03:04.050619 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: latitude
2019-01-11 20:03:04.052409 ERROR AppDaemon: AppDaemon is terminating
2019-01-11 20:03:04.055495 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: longitude
2019-01-11 20:03:04.057426 ERROR AppDaemon: AppDaemon is terminating
2019-01-11 20:03:04.059749 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: elevation
2019-01-11 20:03:04.060793 ERROR AppDaemon: AppDaemon is terminating
2019-01-11 20:03:04.063022 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: time_zone
2019-01-11 20:03:04.064615 ERROR AppDaemon: AppDaemon is terminating
2019-01-11 20:03:04.068533 INFO AppDeamon Exited

appdaemon gets values for timezon, longtitude, latitude and elevation from HASS, if it is not set there correct it looks for those values in appdaemon.yaml

it seems that the values in HASS are not as expected and in appdaemon.yaml not set.

Thanks. All of these values were properly set in the HASS config under the homeassistant: block. All I did was copy them as-is to the appdaemon: section in the appdaemon.yaml file and now it works. So in my case for some reason it is unable to pull the values from HASS config.

What other addons do you have installed?

Too many lol. A restart fixed it

So I want to confirm my understanding of how this should be setup, because all of the videos and setup instructions I’ve watched seem to make it look like this should “just work”. But I’m not seeing that because after the installation of the add-on and configuration of a dashboard, I’m still getting “entity not found: switch.front_porch_switch” messages on my dashboard. Before I go into posting all the logs here I want to make sure that my process for setting up is correct… The hurdles I’m seeing make me feel like appdaemon isn’t able to communicate with hassio (see steps 3 and 7)

  1. I’m running Home Assistant 0.85 (via hassio)

  2. Install the AppDaemon add-on (repository had already been added)

  3. Start the add-on and check the logs. I get errors that I posted above about not being able to read the 4 values for lat, long, etc even though they are in my home assistant configuration.

  4. Add those values and restart the add on. Logs show same stack trace as before, but no messages about lat/long and I get the message “INFO AppDaemon: App initialization complete”.

  5. I open the hello dashboard and it loads.

  6. I add a switch from my /dev-state URL in home assistant, copy paste into layout of the hello world dashboard “switch.front_porch_switch”, save, and reload the dashboard url.

  7. Dashboard shows “entity not found: switch.front_porch_switch” message. Clicking the widget on the dashboard puts a message in log:

    2019-01-13 12:16:07.925712 WARNING HADasboard: Unexpected error in call_service()
    2019-01-13 12:16:07.927692 WARNING HADasboard: ------------------------------------------------------------
    2019-01-13 12:16:07.935307 WARNING HADasboard: Traceback (most recent call last):
    File “/usr/lib/python3.6/site-packages/appdaemon/rundash.py”, line 357, in call_service
    await plugin.call_service (service, **args)
    AttributeError: ‘NoneType’ object has no attribute ‘call_service’

Am I missing a step here in my setup?

  1. shouldnt happen
  2. shouldnt be neccesary, and it would be better to find out why it happens. it also shows that the connection is still broken, because you still got the error. thats probably also why you did get the errors about timezone
  3. even with the errors AD was able to start. AD is evolving to be able to run with several plugins, so if 1 doesnt start it should still run.
  4. off course it cant load the entity, because the connection is still inactive.

please 2 things:

  1. show your appdaemon.yaml
  2. restart appdaemon and show me the log from the start untill it has finished initialising.

I’ll make two posts… one with default config and one where I put the 4 config values it complains about not finding.

For this one… completely uninstalled the add-on and deleted the appdaemon directory. Reinstalled and started the app which created this appdaemon.yaml 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: e8c54c18ee6cfd8535324ac1e8c11697e6aa9e8be35b197e98757fa6fa751f15
hadashboard:
  dash_url: http://127.0.0.1:5050
  dash_dir: /config/appdaemon/dashboards

And produced this log, where appdaemon terminates at the end. Appdaemon restarts and this happens over and over.

[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 / null / HA 0.85.0 / SU 141 / 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.
2019-01-13 15:57:26.085766 INFO AppDaemon Version 3.0.2 starting
2019-01-13 15:57:26.086487 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-01-13 15:57:26.092801 INFO AppDaemon: Starting Apps
2019-01-13 15:57:26.102283 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-01-13 15:57:26.261516 WARNING AppDaemon: error loading plugin: HASS - ignoring
2019-01-13 15:57:26.262209 WARNING AppDaemon: ------------------------------------------------------------
2019-01-13 15:57:26.274586 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 304, in __init__
    mod = __import__(full_module_name, globals(), locals(), [module_name], 0)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassplugin.py", line 6, in <module>
    from sseclient import SSEClient
  File "/usr/lib/python3.6/site-packages/sseclient.py", line 8, in <module>
    import requests
  File "/usr/lib/python3.6/site-packages/requests/__init__.py", line 112, in <module>
    from . import utils
  File "/usr/lib/python3.6/site-packages/requests/utils.py", line 24, in <module>
    from . import certs
  File "/usr/lib/python3.6/site-packages/requests/certs.py", line 15, in <module>
    from certifi import where
  File "/usr/lib/python3.6/site-packages/certifi/__init__.py", line 1, in <module>
    from .core import where, old_where
  File "/usr/lib/python3.6/site-packages/certifi/core.py", line 3
    def test_binary_decode_autodtype(self):
    ^
IndentationError: unexpected indent
2019-01-13 15:57:26.275235 WARNING AppDaemon: ------------------------------------------------------------
2019-01-13 15:57:26.279761 INFO Starting Dashboards
2019-01-13 15:57:26.303704 INFO API is disabled
2019-01-13 15:57:27.307867 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: latitude
2019-01-13 15:57:27.309426 ERROR AppDaemon: AppDaemon is terminating
2019-01-13 15:57:27.313380 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: longitude
2019-01-13 15:57:27.315519 ERROR AppDaemon: AppDaemon is terminating
2019-01-13 15:57:27.317022 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: elevation
2019-01-13 15:57:27.318329 ERROR AppDaemon: AppDaemon is terminating
2019-01-13 15:57:27.319739 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: time_zone
2019-01-13 15:57:27.321071 ERROR AppDaemon: AppDaemon is terminating
2019-01-13 15:57:27.324680 INFO AppDeamon Exited
2019-01-13 15:57:32.648929 INFO AppDaemon Version 3.0.2 starting

rinse and repeat…

And this one where I updated the missing values in the config. It starts successfully, but doesn’t work as previously described.

secrets: /config/secrets.yaml
log:
  logfile: STDOUT
  errorfile: STDERR
appdaemon:
  threads: 10
  app_dir: /config/appdaemon/apps
  latitude: 30
  longitude: -97
  elevation: 202
  time_zone: America/Chicago
  plugins:
    HASS:
      type: hass
      ha_url: http://hassio/homeassistant
      token: 9d2ba1a746136c2b70bcb9a2fbf9fcedfbb443a700a3eec7be9ecc5e53a1479d
hadashboard:
  dash_url: http://127.0.0.1:5050
  dash_dir: /config/appdaemon/dashboards

And the 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 / null / HA 0.85.0 / SU 141 / 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.
2019-01-13 15:53:26.252056 INFO AppDaemon Version 3.0.2 starting
2019-01-13 15:53:26.252780 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-01-13 15:53:26.258371 INFO AppDaemon: Starting Apps
2019-01-13 15:53:26.267549 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-01-13 15:53:26.426493 WARNING AppDaemon: error loading plugin: HASS - ignoring
2019-01-13 15:53:26.427190 WARNING AppDaemon: ------------------------------------------------------------
2019-01-13 15:53:26.438389 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 304, in __init__
    mod = __import__(full_module_name, globals(), locals(), [module_name], 0)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassplugin.py", line 6, in <module>
    from sseclient import SSEClient
  File "/usr/lib/python3.6/site-packages/sseclient.py", line 8, in <module>
    import requests
  File "/usr/lib/python3.6/site-packages/requests/__init__.py", line 112, in <module>
    from . import utils
  File "/usr/lib/python3.6/site-packages/requests/utils.py", line 24, in <module>
    from . import certs
  File "/usr/lib/python3.6/site-packages/requests/certs.py", line 15, in <module>
    from certifi import where
  File "/usr/lib/python3.6/site-packages/certifi/__init__.py", line 1, in <module>
    from .core import where, old_where
  File "/usr/lib/python3.6/site-packages/certifi/core.py", line 3
    def test_binary_decode_autodtype(self):
    ^
IndentationError: unexpected indent
2019-01-13 15:53:26.438966 WARNING AppDaemon: ------------------------------------------------------------
2019-01-13 15:53:26.440293 INFO Starting Dashboards
2019-01-13 15:53:26.464090 INFO API is disabled
2019-01-13 15:53:27.882368 INFO AppDaemon: Reading config
2019-01-13 15:53:27.890041 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-01-13 15:53:27.890631 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-01-13 15:53:27.891145 INFO AppDaemon: App 'hello_world' added
2019-01-13 15:53:27.891877 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-01-13 15:53:27.893217 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2019-01-13 15:53:27.911849 WARNING AppDaemon: ------------------------------------------------------------
2019-01-13 15:53:27.912545 WARNING AppDaemon: Unexpected error loading module: /config/appdaemon/apps/hello.py:
2019-01-13 15:53:27.913131 WARNING AppDaemon: ------------------------------------------------------------
2019-01-13 15:53:27.917922 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 2026, in check_app_updates
    self.read_app(mod["name"], mod["reload"])
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 1809, in read_app
    self.modules[module_name] = importlib.import_module(module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/appdaemon/apps/hello.py", line 1, in <module>
    import appdaemon.plugins.hass.hassapi as hass
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 1, in <module>
    import requests
  File "/usr/lib/python3.6/site-packages/requests/__init__.py", line 112, in <module>
    from . import utils
2019-01-13 15:53:27.919197 WARNING AppDaemon: Removing associated apps:
  File "/usr/lib/python3.6/site-packages/requests/utils.py", line 24, in <module>
    from . import certs
  File "/usr/lib/python3.6/site-packages/requests/certs.py", line 15, in <module>
    from certifi import where
  File "/usr/lib/python3.6/site-packages/certifi/__init__.py", line 1, in <module>
    from .core import where, old_where
  File "/usr/lib/python3.6/site-packages/certifi/core.py", line 3
    def test_binary_decode_autodtype(self):
    ^
IndentationError: unexpected indent
2019-01-13 15:53:27.918582 WARNING AppDaemon: ------------------------------------------------------------
2019-01-13 15:53:27.919867 WARNING AppDaemon: hello_world
2019-01-13 15:53:27.922703 INFO AppDaemon: App initialization complete
2019-01-13 15:53:34.184379 INFO HADashboard: New dashboard connected: Main Panel

i do see some certs in those errors.
do you have SSL setup in HA?

if so you might need

      cert_path: <path/to/root/CA/cert>
      cert_verify: True

in the plugin section.
and then the url should be https://hassio/homeassistant i think

i would expect that if you have that, that the addon would take care of that, but i do know to little about hassio and what the addon does or doesnt.

the error is to unfamiliar to me to make anything else from it.
maybe @aimc knows more about it.

I will try your suggestion, but one of the debugging steps I tried was to turn off SSL in HA and I believe these same errors were still in the log.

if you try such things its wise to clear logs, turn of the power from your device and reboot with the changed environment.
then you can be sure that the settings from that moment actually are the working ones.

often we forget what the order is of changes that we actually made, and just the right combination falls through.
maybe you installed appdaemon with SSL off and did you turn it on again afterwards.

when you have ssl in HA you need to have the settings in AD
when you dont have SSL in HA you need to have no settings in AD.

:smile: I had a conflict with Traccar. That addon opens a huge list of ports (of which one is 5050) for all potential devices to track so had to move the mapping of port 5050.