Debugpy and Custom Components and Integrations


I’m hoping that you can help me.

I’ve setup debugpy and connected Visual Studio Code and have it attaching and working, I can set break points in the core home assistant :smile: and it works really well.

What I would now like to do is use it to develop and debug my Custom Component here.

But I’m having problems. I added a Folder to the Workspace where the source code is located that is mapped to the Home Assistant path i.e. they are the same files in both local and remote.

This is my launch.json

    // For more information, visit:
    "version": "0.2.0",
    "configurations": [
            // Example of attaching to my production server
            "name": "Python: Attach Remote",
            "type": "python",
            "request": "attach",
            "port": 5678,
            "host": "",
            "pathMappings": [
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "/usr/src/homeassistant"
                    "localRoot": "Y:/custom_components/visonic",
                    "remoteRoot": "/config/custom_components/visonic"

So in the 2nd path mapping I have the local and remote paths for my custom component.

The problem that I am struggling with is that the files in the custom component cannot “import” the core files. This is the error I get

and this is the section of the file it refers to

I import from a file in my custom component and it also fails to find that (line 18)

I cannot find any help or instructions on setting up debugpy for use with custom components, onyl for the core development.

EDIT: In case it’s relevant, I’m using Home Assistant 0.113.1 in Docker on a Synology NAS

Any help would be appreciated