Skip to content

[BUG] ControllerX + AppDaemon Crash with WebSocket Disconnect in Docker Setup #1225

@fir3drag0n

Description

@fir3drag0n

🐞 Bug Report: ControllerX + AppDaemon Crash with WebSocket Disconnect in Docker Setup

Environment

  • ControllerX Version: v5.0.0
  • AppDaemon Version: 5.5
  • Python Version: 3.12
  • Home Assistant Version: 2025.7.4
  • Installation Method: Docker (on Unraid)
  • MQTT Integration: zigbee2mqtt

🔧 Configuration Summary

plugins:
  HASS:
    type: hass
    ha_url: http://192.168.1.113:8123
    token: !secret ha_token
    cert_verify: false
    delay: 15   # was also tested with delay: 30 and delay: 60
  MQTT:
    type: mqtt
    namespace: mqtt
    client_host: 192.168.1.191
    client_user: admin
    client_password: !secret mqtt_pw

Each apps.yaml entry includes valid light: or cover: fields. No misconfigurations are present.


❗ Problem Description

After upgrading to AppDaemon 5.5 and ControllerX 5.0.0 in a Docker environment, all ControllerX apps fail on startup with the following error:

TypeError: argument of type 'NoneType' is not iterable
aiohttp.client_exceptions.ClientConnectionResetError: Cannot write to closing transport

The AppDaemon logs confirm the WebSocket connection to HA is established successfully (auth_ok received), but shortly after, the connection drops and is restarted in a loop:

INFO HASS: Connected to Home Assistant 2025.7.4 with aiohttp websocket
INFO HASS: Authenticated to Home Assistant 2025.7.4
WARNING HASS: Timed out [0:00:10] waiting for request: {'type': 'get_states', 'id': 5}
ClientConnectionResetError: Cannot write to closing transport

Attempts to mitigate:

  • Verified HA responds correctly to WebSocket auth (auth_ok confirmed via wscat)
  • Confirmed no firewall or port issues
  • Confirmed token is valid and works manually
  • Used delay: and custom AppDaemon app to wait for HA reconnect
  • Tried both IP (192.168.1.113) and Docker service name (homeassistant) as ha_url

📎 Logs Provided

  • appdaemon.log
  • error.log

✅ Expected Behavior

ControllerX should either:

  • Retry initialization cleanly when HA is not fully ready
  • Delay entity fetching until HA connection is stable
  • Or AppDaemon should not crash on temporary WebSocket transport errors

📌 Additional Notes

This may be related to recent aiohttp versions or how ControllerX v5 handles asynchronous entity resolution during init.

Please advise if this is known or if I can assist with more debug detail.

Thanks!

error (1).log
appdaemon (1).log
error.log
appdaemon.log

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions