Cannot connect to ha from docker

Cannot get Appdaemon to connect to my HA instance… and can’t figure out why… It works in a virtenv and the tokens also works when I use curl… So wtf does it not work? Also… Maybe update the docker image with the lastest appdaemon code?

docker-compose.yaml

version: '3'

services:
  appdaemon:
    container_name: appdaemon
    image: acockburn/appdaemon:latest
    environment:
      - EXTRA_CMD=-D DEBUG
      - HA_URL="http://10.0.1.50:8123"
      - TOKEN="verylonglivedtoken"
    ports:
      - 5050:5050
    volumes:
      - /opt/Applications/Appdaemon/conf:/conf
    restart: always

appdaemon.yaml

appdaemon:
  threads: 10
  plugins:
    HASS:
      type: hass
      ha_url: http://10.0.1.50:8123
      token: sameverylongtokenagain

In order for containers to “talk” they have to be in the same network. Define it in docker-compose and add both containers.

Naah, that’s not it… The HA is “outside” of docker and is reachable from inside the docker (i’ve pinged it). Also if I use curl from inside the docker, with the same token… It connects :frowning:

The error is: Error in authentication (and it is connecting) so the network is ok, just the token does not work somehow… Does work if I use curl…

2019-08-21 14:44:51.910282 WARNING AppDaemon: HASS: ------------------------------------------------------------
appdaemon    | 2019-08-21 14:44:56.921432 INFO AppDaemon: HASS: Connected to Home Assistant 0.97.2
appdaemon    | 2019-08-21 14:44:56.927525 WARNING AppDaemon: HASS: Error in authentication
appdaemon    | 2019-08-21 14:44:56.927698 DEBUG AppDaemon: Event type:ha_disconnected:
appdaemon    | 2019-08-21 14:44:56.927771 DEBUG AppDaemon: {}
appdaemon    | 2019-08-21 14:44:56.927850 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
appdaemon    | 2019-08-21 14:44:56.927916 WARNING AppDaemon: HASS: ------------------------------------------------------------
appdaemon    | 2019-08-21 14:44:56.927977 WARNING AppDaemon: HASS: Unexpected error:
appdaemon    | 2019-08-21 14:44:56.928037 WARNING AppDaemon: HASS: ------------------------------------------------------------
appdaemon    | 2019-08-21 14:44:56.928228 WARNING AppDaemon: HASS: Traceback (most recent call last):
appdaemon    |   File "/usr/local/lib/python3.6/site-packages/appdaemon/plugins/hass/hassplugin.py", line 209, in get_updates
appdaemon    |     raise ValueError("Error in authentication")
appdaemon    | ValueError: Error in authentication

To make matters even more weird… If I run the same docker-compose file with the same appdaemon.yaml on the same host that runs ha, it does connect… It’s like there is an issue with the websocket?

Because the tcp/ip network is ok (I can ping and curl). The token is ok, because I can fetch stuf with curl using the long-lived-token, all from inside the docker.