VS Code remote

Hi all
I have been making extensive use of the new-ish VS code feature remote development. TLDR it allows you to develop on a remote pi over SSH using VS code. This is useful both for editing config, but also if you are doing development which requires a physical pi, such as working with GPIO/I2C etc. A couple of gotchas, you need to install VS code Insiders addition, then install the Remote addon. You will then Remote: Connect to host and enter [email protected] and select the directory you wish to work in (.homeassistant).
Cheers

6 Likes

Sorry for this beginner question, does this also work with an hass.io running on the raspberrypi?

It doesn’t work on Hassio, which is a custom OS. I’m running Hassbian

it also works great on HA in Docker on Ubuntu… thanks for the tip!!!

1 Like

@lubeda, on Hassio you can use the AddOn: Visual Studio Code.

The VSCode addon isn’t available for RPi’s… (or it wasn’t last time I checked)

1 Like

Oops! Sorry, didn’t know that.

1 Like

With Pi/Hassio you can still use VSCode and setup SFTP to automatically upload/download changes to files on your Pi.
So you both have a backup on your laptop/dev machine and can easily make changes to the files on the Pi.

Thanks for this tip, I’m trialing that now, using docker-compose and starting home assistant with
CMD [ "python3", "-m", "homeassistant", "--config", "/config" ] in the docker-compose file.

I can connect to the folder ok but how do you restart home-assistant to show the latest changes? Any way to do automatic reloading?

Well now i am trying to develop on my windows pc with docker. There is still a lot to learn but the way looks right.

1 Like

I am also using the VSCODE remote dev a lot. But I have issues to use it on HomeAssistent. I am getting the follwowing error message, when I try to connect:

The remote host may not meet VS Code Server's prerequisites for glibc and libstdc++

any ideas how to fix this?

2 Likes

I tried everything possible for the past few days and realized that on HassOS, neither the SSH add-on nor direct SSH to the host will work via remote SSH on a local VS Code install on your desktop/laptop.

The add-on fails as Alpine Linux, which it is based on, does not support the required libraries that @Geraldf mentioned, in order to run remote SSH.

The HassOS host fails because it starts without a TTY and offers one only after the user types in ‘login’.

Accessing the folder via a Samba mount works, but is much slower than SSH during git operations and often gives phantom file changes in git, probably due to permissions changes owing to Samba’s default mask settings.

I wish there was a way to get SSH remote development to work. Leaving this comment here, in case anyone posts an approach that I might have missed.

3 Likes

@ajayjohn thanks for dissecting the issue, suggest raising it in the dev discord forums to ensure it isn’t missed (core devs not on this forum much)

Just did that. Thanks! :+1:t3:

It is avaible on 64bit OS Version on the Pi 3 and 4.

1 Like

I found another SSH plugin for VSCode that made the trick. Try if it works @ajayjohn

1 Like

Still using this addon?
I try to connect to HA but get error message “Error while connecting to SSH FS homeassistant: Handshake failed: no matching client->server HMAC”

Everything works when I ssh to HA with terminal with the same credentials

1 Like

@hoogen Can you hare some info on how to get this setup?

There is an add-on that provides VSCode Remote in Hassio’s edge repository . I’ve been using it for the past week and it works well.

Sorry no, havn’t used this exept some testing about a year ago.