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

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