How to develop custom component in dev environment?

Hi,

I created a custom component

For develop and debug it, I use vscode and I copy the files in my environment “core (dev container Home Assistant Dev)”

then I manually copy the differences in my custom component (with the time wasted and the risk of error)

How can I integrate reposy directly into my core environment?

I hope you find an answer also for my info. I am trying to tweak/support/add things but find the devs rather unreachable and secluded. I donot want to make this sound as negative but for starters (like me) in this area it is hard to get through to the how-to’s. Tthere is little documentation around flow/process/etc. and very few people have time/interest in guiding (I do !! understand that). Possibly related to open-source approach?

It seems that we can use a submodule but I don’t understand how it works:

  • which is is the submodule; core or custom component?

  • can we create it in vscode? I saw tortoisegit. Can this software help?

  • if core is the module and custom component the submodule.

    - how to indicate that the custom component is in the config directory?
    - how to indicate that the pushes are made from the custom component?

I would try to raise this in the #devs section of the HA discord.

Check here: Developing Home Assistant Core in a VSCode Devcontainer

Especially mount part

When I developped my integration, I found it easiest to place it in core\homeassistant\components\duepi_evo (so not as a custom integration…)

Since I am working from my own devs core repository, i simply can push directly to it, however, I never create a push requests HA directly, instead I copy to my git custom integration folder and push there.
Since this custom repository is linked to HACS, it will be available shorty after in HA for everyone that uses it…

But yeah, I agree, I still have to copy. As long as my integration is not part of HA’s repository, I don’t think there is another solution…
For me working through HACS works fine…

So, you can use external mounts inside devcotainer and you don’t need to copy following link above. It helped me a lot

Hi @fuatakgun,

Can you explain how to, I’m lost. Thank’s

Please check here specially;

You create a mount point inside devcontainer mapping to custom_components folde, from your original folder outside of container.

Hi @anon63427907,

I have a working Dev container: Home assistant Dev
localy in

c:\user\thier\Hassio-dev\core...

I cloned my component [Home-Assistant-custom-components-SmartThings-Soundbar]Home-Assistant-custom-components-SmartThings-Soundbar)in the same path
so I have

C:\Users\thier\Hassio-dev\Home-Assistant-custom-components-SmartThings-Soundbar\custom_components\smartthings_soundbar

I add mount in “.devcontainer file” in the "core:[Dev Container: Home Assistant] Dev] "

{
  "mounts": [
    // Custom component
    "source=${localEnv:HOME}/Hassio-dev/Home-Assistant-custom-components-SmartThings-Soundbar/custom_components/smartthings_soundbar,target=${workspaces/core}/config/custom_components/smartthings_soundbar,type=bind"
    ]
  "name": "Home Assistant Dev",
  "context": "..",
...

What is wrong ?

this is my setup;

this is my mount config, please pay attention to double backslashes;

"mounts": ["source=c:\\ha\\eufy_security\\custom_components\\eufy_security,target=${containerWorkspaceFolder}/config/custom_components/eufy_security,type=bind"],

after this config, please re-build your container and you will have your custom component available.
image

1 Like

@anon63427907
Thank’s a lot
it works

1 Like