Unable to connect Appdaemon to Home Assistant

I was originally successful at connecting AppDaemon to Home Assistant, but after a few days, I began getting the following error: WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds

I tried using the advice on the following page: Consistent disconnect from HASS

and I tried changing to ha_url to the IP address on port 8123, hostname on port 8123, and HTTP ://hassio/homeassistant, and variants with/without the port

The hostname and IP address kept the disconnected and retrying error described above, but the http://hassio/homeassistant address resulted in the following error:

INFO HASS: Connected to Home Assistant 2022.6.2
ARNING HASS: Error in authentication
WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds

I’ve also tried updating Home Assistant to the newest version, reverting back to a previously working backup, disabling apps, and creating new Long-Lived Access Tokens without any luck.

Any help in fixing this would be much appreciated.

I’m running Home Assistant through hassio on a raspberry pi 3 b+

My appdaemon.yaml is shown below

appdaemon:
  latitude: 42.5
  longitude: -71.5
  elevation: 80
  time_zone: America/New_York
  plugins:
    HASS:
      type: hass
      # ha_url: http://10.0.0.23:8123/
      ha_url: http://hassio/homeassistant
      token: <xxx>
http:
  url: http://homeassistant.local:5050/
admin:
api:
hadashboard:
      

My log file with the authentication error is shown below

[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: AppDaemon
 Python Apps and Dashboard using AppDaemon 4.x for Home Assistant
-----------------------------------------------------------
 Add-on version: 0.8.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 8.1  (aarch64 / raspberrypi3-64)
 Home Assistant Core: 2022.6.2
 Home Assistant Supervisor: 2022.05.3
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] appdaemon.sh: executing... 
[cont-init.d] appdaemon.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[18:50:58] INFO: Starting AppDaemon...
2022-06-06 18:51:03.836732 INFO AppDaemon: AppDaemon Version 4.2.1 starting
2022-06-06 18:51:03.837855 INFO AppDaemon: Python version is 3.9.7
2022-06-06 18:51:03.839250 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2022-06-06 18:51:03.840433 INFO AppDaemon: Added log: AppDaemon
2022-06-06 18:51:03.841832 INFO AppDaemon: Added log: Error
2022-06-06 18:51:03.842997 INFO AppDaemon: Added log: Access
2022-06-06 18:51:03.844321 INFO AppDaemon: Added log: Diag
2022-06-06 18:51:03.965491 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2022-06-06 18:51:04.212083 INFO HASS: HASS Plugin Initializing
2022-06-06 18:51:04.214062 INFO HASS: HASS Plugin initialization complete
2022-06-06 18:51:04.219265 INFO AppDaemon: Initializing HTTP
2022-06-06 18:51:04.222500 INFO AppDaemon: Using 'ws' for event stream
2022-06-06 18:51:04.257582 INFO AppDaemon: Starting API
2022-06-06 18:51:04.275454 INFO AppDaemon: Starting Admin Interface
2022-06-06 18:51:04.277872 INFO AppDaemon: Starting Dashboards
2022-06-06 18:51:04.360825 INFO HASS: Connected to Home Assistant 2022.6.2
2022-06-06 18:51:04.373440 WARNING HASS: Error in authentication
2022-06-06 18:51:04.378292 WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds
2022-06-06 18:51:04.403608 INFO AppDaemon: App 'hello_world' added
2022-06-06 18:51:04.410107 INFO AppDaemon: App 'ac_controller' added
2022-06-06 18:51:04.412357 INFO AppDaemon: Found 2 total apps
2022-06-06 18:51:04.414983 INFO AppDaemon: Starting Apps with 2 workers and 2 pins
2022-06-06 18:51:04.420332 INFO AppDaemon: Running on port 5050
2022-06-06 18:51:09.429513 INFO HASS: Connected to Home Assistant 2022.6.2
2022-06-06 18:51:09.440922 WARNING HASS: Error in authentication
2022-06-06 18:51:09.443480 WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds
2022-06-06 18:51:12.870406 INFO AppDaemon: New client Admin Client connected
2022-06-06 18:51:14.499464 INFO HASS: Connected to Home Assistant 2022.6.2
2022-06-06 18:51:14.512766 WARNING HASS: Error in authentication
2022-06-06 18:51:14.515310 WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds

And my log with the disconnected error is shown below:

[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... 
-----------------------------------------------------------
 Add-on: AppDaemon
 Python Apps and Dashboard using AppDaemon 4.x for Home Assistant
-----------------------------------------------------------
 Add-on version: 0.8.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 8.1  (aarch64 / raspberrypi3-64)
 Home Assistant Core: 2022.6.2
 Home Assistant Supervisor: 2022.05.3
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] appdaemon.sh: executing... 
[cont-init.d] appdaemon.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[19:05:43] INFO: Starting AppDaemon...
2022-06-06 19:05:51.001575 INFO AppDaemon: AppDaemon Version 4.2.1 starting
2022-06-06 19:05:51.002697 INFO AppDaemon: Python version is 3.9.7
2022-06-06 19:05:51.004095 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2022-06-06 19:05:51.005385 INFO AppDaemon: Added log: AppDaemon
2022-06-06 19:05:51.007105 INFO AppDaemon: Added log: Error
2022-06-06 19:05:51.008590 INFO AppDaemon: Added log: Access
2022-06-06 19:05:51.009884 INFO AppDaemon: Added log: Diag
2022-06-06 19:05:51.162417 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2022-06-06 19:05:51.463652 INFO HASS: HASS Plugin Initializing
2022-06-06 19:05:51.465820 INFO HASS: HASS Plugin initialization complete
2022-06-06 19:05:51.468906 INFO AppDaemon: Initializing HTTP
2022-06-06 19:05:51.471314 INFO AppDaemon: Using 'ws' for event stream
2022-06-06 19:05:51.499131 INFO AppDaemon: Starting API
2022-06-06 19:05:51.516650 INFO AppDaemon: Starting Admin Interface
2022-06-06 19:05:51.518745 INFO AppDaemon: Starting Dashboards
2022-06-06 19:05:51.558057 WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds
2022-06-06 19:05:51.605295 INFO AppDaemon: App 'hello_world' added
2022-06-06 19:05:51.610758 INFO AppDaemon: App 'ac_controller' added
2022-06-06 19:05:51.612752 INFO AppDaemon: Found 2 total apps
2022-06-06 19:05:51.615117 INFO AppDaemon: Starting Apps with 2 workers and 2 pins
2022-06-06 19:05:51.620180 INFO AppDaemon: Running on port 5050
2022-06-06 19:05:53.888242 INFO AppDaemon: New client Admin Client connected
2022-06-06 19:05:55.906789 INFO AppDaemon: New client Admin Client connected
2022-06-06 19:05:56.588711 WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds
2022-06-06 19:06:01.609273 WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds

Hi. I don’t know why it’s failing for you. You can try my setup to see if it works. You can ignore the mqtt part.

secrets: /config/secrets.yaml

appdaemon:
  latitude: !secret home_latitude
  longitude: !secret home_longitude
  elevation: !secret home_elevation
  time_zone: Japan
  plugins:
    HASS:
      type: hass
      ha_url: http://192.168.1.20:8123
      token: !secret appdaemon_token
      namespace: default
    MQTT:
      type: mqtt
      namespace: mqtt
      client_host: 192.168.1.20
      client_port: 1883
      ca_cert: mqtt-ca.crt # remove if expired. ssl folder
      client_cert: mqtt-server.crt # remove if expired. ssl folder
      client_key: mqtt-server.key # remove if expired. ssl folder
      client_user: !secret mqtt_user
      client_password: !secret mqtt_pass
      birth_topic: appdaemon
      will_topic: appdaemon

http:
  url: http://127.0.0.1:5050
hadashboard:
admin:
api:

Hi Lucas, did you ever find a solution? Unfortunately, I have exactly the same problem and so far all my attempts have failed.

Thanks

Chris

I feel a bit silly, but my issue here was that I was not copying the entire token. I kept double-clicking on the text, then CTRL+C to copy, but since there was a period in the token my “double-click to highlight all” action was not actually highlighting the entire key, though it looked like I was since the key was longer than the text box I was copying from.

I fixed my issue by using CTRL+A, CTRL+C to copy the token I generated.

1 Like