added debugger support
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,3 +2,5 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
|
logs/
|
||||||
|
apps/data/
|
||||||
|
|||||||
16
.vscode/launch.json
vendored
16
.vscode/launch.json
vendored
@@ -4,6 +4,22 @@
|
|||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Attach to AppDaemon",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "attach",
|
||||||
|
"connect": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 5678
|
||||||
|
},
|
||||||
|
"pathMappings": [
|
||||||
|
{
|
||||||
|
"localRoot": "${workspaceFolder}",
|
||||||
|
"remoteRoot": "/conf"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"justMyCode": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Run Unit Tests",
|
"name": "Run Unit Tests",
|
||||||
"type": "debugpy",
|
"type": "debugpy",
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
debugger:
|
||||||
|
module: debugger
|
||||||
|
class: Debugger
|
||||||
|
port: 5678
|
||||||
|
|
||||||
motion_tracker:
|
motion_tracker:
|
||||||
module: motiontracker
|
module: motiontracker
|
||||||
class: MotionTracker
|
class: MotionTracker
|
||||||
|
|||||||
12
apps/debugger.py
Normal file
12
apps/debugger.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import appdaemon.plugins.hass.hassapi as hass
|
||||||
|
import debugpy
|
||||||
|
|
||||||
|
|
||||||
|
class Debugger(hass.Hass):
|
||||||
|
def initialize(self):
|
||||||
|
port = int(self.args.get("port", 5678))
|
||||||
|
try:
|
||||||
|
debugpy.listen(("0.0.0.0", port))
|
||||||
|
self.log(f"debugpy listening on port {port}")
|
||||||
|
except RuntimeError:
|
||||||
|
self.log("debugpy already listening, skipping")
|
||||||
Reference in New Issue
Block a user