Best way to go for remote dev on a Pi3 using VSC on Win10?

Just starting out.
Hoping to contribute to growth but first,
Which guide should I follow to start dev work on a custom component when Home Assistant Supervised running on a Pi3 , using VSC installed on Win10 ?

As the author of the first post I generally develop locally using unit tests to verify things are working like I think they should. When I want to test something out in HA, I scp the files to the custom components directory on my home assistant installation and restart it to apply the changes.

You may also be able to mount the custom_components directory using sshfs locally then use vscode to edit your files without having to copy any files over ssh.

I haven’t tried the develop environment setup in the 2nd link with a local instance of HA but that sounds interesting.

Actually re-reading your post, since you are on Windows I might lean towards the 2nd link you posted. Everything still applies in that post and subsequent posts on developing your component regardless of how you have your environment setup.

Thanks for your reply and help. Not easy following the docs on this as the text is/perceived to be - vauge. Can you elaborate please @fahr in regard to the 2nd dev post above…

My Pi is headless . So if i am using my Win10 box to develop remotely with the custom_components mounted using sshfs:-

  • Do I install git on the Pi or on Win10. It is already on the Pi.
  • Docker - that’s also running on the Pi - why is it needed on Win10 or have I read the post wrong?
  • Remote Containers VSC plugin obviously on Win10?
  • What about python3 libs and interpreter ? or is that installed into the container by virtue of it being built into the image through the fork of a HA repo?

TIA.

Assuming you are talking about Developing with Visual Studio Code + devcontainer, all of the per-requisites listed there you would need to install on your Win10 machine. Docker is needed on your Win10 machine so that you can run the development container in visual studio code. Since you will be using docker you don’t need to worry about the python 3 libs, they will already be installed in the dev container.

I’ve never tried this out but do use VSCode, so I’m going to try to set this up tonight to see how it works. So thanks for bringing this to my attention!

Mmm, ok, but that kind of isn’t remote development I would assert,? Not sure what "remote’ is referring to? The laptop will be doing all the workload, the remote would simply be - would it not - a mounted filesystem or shared folder (s)?

Correct, this wouldn’t be doing any remote development, all of it would be done on your Win10 laptop.

Ok pal, so all good this end.
Followed this guide to create a trivial container that runs a bash script which logs “Hello World” to output log:

…and output in the log file:

What was great is that there was no need to worry about the upstream dev environment for this is built as part of the container image.where needed. In this case, nothing more needed but one can imagine how much less hassle is needed.

Docker was not needed on the host (laptop) but is already installed on the remote and when installing the addon from the ‘Local’ tab - the remote Docker session was used to build the addon. GREAT! So all one needs is VSC on the host.

So although not “pure true” remote development, the ability to map the /addons dir as a workspace folder - over sshfs - and combined with Docker , simplifies the toolchain setup greatly. All I need to do now is read the undocumented Home Assistant Supervised reference manual for coders :slight_smile: