Solved. Here’s what helped: (thanks to discord: @balloob)
Open Docker Desktop and check the container’s url by clicking “open in browser”. Mine opened a browser window to http://127.0.0.1:8123/
{
// Example of attaching to local debug server
"name": "Python: Attach Local",
"type": "python",
"request": "attach",
"port": 5678,
"host": "127.0.0.1", // same as the browser that was opened by Docker Desktop.
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
}
Then run this in the terminal:
hass -c config --debug
The debug window will show that debugpy is taking >10 secs to startup, ignore this; its just waiting for you to start the debug session, so do this:
From the RUN drop menu, select “Python: Attach Local”
Add your breakpoints, and click F5 (Start Debugging).