I would like to extend an existing integration. I will fork the git repo and after I am done adding everything, create a PR.
I have never developed for HA but I have programming experience. I do not want to spin up a dedicated dev system but just work with my normal install (HA OS + HACS).
Conceptually, what’s the best approach to do this?
Do I directly “git clone” in the “custom_components” directory?
I assume I need to remove the existing extension (from a custom HACS repository) first?
Do I then edit the files in-place or do people edit on a host system and do “git pull”?
In case of “in place” editing, how to do this best? “vi” works but it’s pretty cumbersome for me
Especially at the beginning, there will be lots of iterations between editing files and trying them out. How do I make sure that my changes are applied? Is it sufficient to just reload the extension after each change?
What constraint is in place that you don’t want a development environment? It’s easy to spin one up using vscode and devcontainers and will be a lot easier to work with.
My question is more about how to make changes to existing code (“develop”), how to see and verify the changes and how then push them back to the repository.
Because it’s really just a few lines of code that I want to change. I don’t want to spin up an entirely new developing platform for this.
As a matter of fact, right now I don’t even own a private PC any more. Just my work laptop and my servers. Can’t easily install stuff on my work laptop and doing all of this via a proxmox container/VM via ssh it’s a huge amount of effort for a couple of lines of code.
$ my_custom_forked_extension pwd
/root/homeassistant/custom_components/my_custom_forked_extension
$ my_custom_forked_extension git status
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
$ my_custom_forked_extension
Sorry, I thought that was how I set-up some stuff ages ago. However, HACS uses a specific folder structure and hence you need to keep that intact. The way to do that is to use a symlink - create a /share/custom_components folder and clone the repo into that: