From 51aea99f574333fd3ac12d519270726c43065c67 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 9 May 2026 13:36:29 +0200 Subject: [PATCH] Change debugger strategy to try fix debugger being unresponsive issue --- .vscode/launch.json | 1 + appdaemon.yaml | 3 +++ apps/apps.yaml | 11 ++++++----- apps/debugger.py | 6 ++++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 777634b..4da0a47 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,6 +12,7 @@ "host": "localhost", "port": 5678 }, + "steppingResumesAllThreads": true, "pathMappings": [ { "localRoot": "${workspaceFolder}", diff --git a/appdaemon.yaml b/appdaemon.yaml index c0725ba..85eeddb 100644 --- a/appdaemon.yaml +++ b/appdaemon.yaml @@ -3,6 +3,7 @@ appdaemon: longitude: 0 elevation: 30 time_zone: Europe/Berlin + internal_function_timeout: 00:20:00 exclude_dirs: - unit_tests plugins: @@ -11,6 +12,8 @@ appdaemon: ha_url: http://10.0.0.21:8123 token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiZThhYWI2ZTlkNmQ0NWU2YTk1ODU5OWJjOWM3MWJkYiIsImlhdCI6MTc3NjEwOTc0NCwiZXhwIjoyMDkxNDY5NzQ0fQ.BorkjFjWlWCZqnUa9-NMUxGsDiupDoRZ3cEgsmeSofM cert_verify: True + q_timeout: 1200 + ws_timeout: 00:10:00 http: url: http://0.0.0.0:5050 admin: diff --git a/apps/apps.yaml b/apps/apps.yaml index cf845b4..39a3b4c 100644 --- a/apps/apps.yaml +++ b/apps/apps.yaml @@ -1,8 +1,9 @@ -# I now directly run AppDaemon with debugpy in DockerStart.sh. Not sure which is best -# debugger: -# module: debugger -# class: Debugger -# port: 5678 +debugger: + module: debugger + class: Debugger + priority: 0 + port: 5678 + wait_for_client: false # set to true when you need to debug initialize() motion_tracker: module: motiontracker diff --git a/apps/debugger.py b/apps/debugger.py index 85d53b5..b6dc461 100644 --- a/apps/debugger.py +++ b/apps/debugger.py @@ -5,8 +5,14 @@ import debugpy class Debugger(hass.Hass): def initialize(self): port = int(self.args.get("port", 5678)) + wait_for_client = bool(self.args.get("wait_for_client", False)) try: debugpy.listen(("0.0.0.0", port)) self.log(f"debugpy listening on port {port}") except RuntimeError: self.log("debugpy already listening, skipping") + + if wait_for_client: + self.log(f"waiting for debug client on port {port}") + debugpy.wait_for_client() + self.log("debug client attached")