Skip to content

Commit

Permalink
chore (ide): Fix debugging setup for vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
agittins committed May 9, 2024
1 parent e8a0ba3 commit e77f28c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
34 changes: 22 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Remote Attach",
"name": "HomeAssistant(debug)",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"request": "launch",
"justMyCode": false,
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
"module": "homeassistant",
"args": ["--debug", "-c", "config"]
},
// This is the old (attempted) config of attaching to an already-running
// instance, but I couldn't get breakpoints to work in the custom_component.
// {
// "name": "Python Debugger: Remote Attach",
// "type": "debugpy",
// "request": "attach",
// "connect": {
// "host": "localhost",
// "port": 5678
// },
// "justMyCode": false,
// "pathMappings": [
// {
// "localRoot": "${workspaceFolder}",
// "remoteRoot": "."
// }
// ]
// },
{
// Example of attaching to my production server
"name": "Python: Attach Remote",
Expand Down
10 changes: 10 additions & 0 deletions scripts/develop
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

set -e

# #### Oh, hey...
# If you're using vscode, rather than using this I'd
# suggest running the debugger directly. As of now there's
# a working(!) debugpy entry in launch.json (just hit F5)


cd "$(dirname "$0")/.."

#if [[ ! -f venv/bin/activate ]]; then
Expand All @@ -22,6 +28,10 @@ fi
## This let's us have the structure we want <root>/custom_components/integration_blueprint
## while at the same time have Home Assistant configuration inside <root>/config
## without resulting to symlinks.
#
# Meh.. this used to work with the python extensions built-in debugger,
# but that's deprecated and the below didn't seem to work with the
# debugpy extension. Instead don't use this script and just hit F5.
export PYTHONPATH="${PYTHONPATH}:${PWD}/custom_components"

# Start Home Assistant
Expand Down

0 comments on commit e77f28c

Please sign in to comment.