Change debugger strategy to try fix debugger being unresponsive issue

This commit is contained in:
2026-05-09 13:36:29 +02:00
parent 0e14281516
commit 51aea99f57
4 changed files with 16 additions and 5 deletions

1
.vscode/launch.json vendored
View File

@@ -12,6 +12,7 @@
"host": "localhost",
"port": 5678
},
"steppingResumesAllThreads": true,
"pathMappings": [
{
"localRoot": "${workspaceFolder}",

View File

@@ -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:

View File

@@ -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

View File

@@ -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")