Home Assistant Community Add-on: Visual Studio Code

Using this add-on for a while but one issue at the moment, i always had colors in the code for good readability but that is not working any more.

The file is recognised as homeassistant so thans good, but all code is black. Only indents have colors.
Is there a way to get this back? I already removed the add-on and reinstalled it but that didn’t solve it.

I too am having an issue launching/running VSC after upgraded my HA install to 2022.8.7 (Supervisor 2022.8.5, OS 8.5) - I am running in a VM if it makes a difference.

After HA update VSC wouldn’t load after selecting from the side bar. I uninstalled via HACS and attempted a reinstall via HACS and received the following message.Capture

I have attempted a reboot and still no luck?

It appears you are using docker (as am I). As I am using a docker on RPI, that is completely unsupported for the add-on if used on the rpi, in that case it needs to be the ha os. In your case since you HA is running on a vm, I would think the docker situation in your case would not be a roadblock. Ugh!

It is puzzling as I have been using VSC for over a year and it just now broke with the latest HA update? Maybe the next update will allow it to work again?

i only had 1gb allocated to my VM when i was testing a few things and this addon would cause HA to lock up within a minute or two. i bumped it to 2gb and haven’t had an issue again.

It seems that there is currently a memory leak. It seems to start when I switch to the VSCode tab, and it continues until HA locks up.
I have to reboot to prevent HA totally locking up.

Here is a graph of memory use after opening VSCode.
CPU use graph is similar to memory.
image

The add-on worked before for me. It has been some time since I last used it.
Some update to HA or HA OS must have broken it?

EDIT: I found the cause for this. I had opened the root directory / in VSCode. And I just realised all my problems started after doing that.

So I opened the VSCode tab and opened the /config folder. I checked the memory and CPU and they were racing up again like I expected. I then quickly rebooted HA before it locked up.

After reboot, I tried the VSCode tab again, and it opened in the /config directory now by default. I switched back and forth on the tabs, and checked memory use. This time, It stays under 20% at all times.

So, TLDR: don’t open the root folder / with this add-on for now, or you get a real hot and unresponsive Raspberry Pi. If you use an SD card, all that swapping can destroy it as well.

2 Likes

Hm…Not here…
Running latest HA on Synology’s VM, 4GB of RAM assigned, 20-30% used. Running VSC makes no difference.
How on earth did you manage to open root? My “root” (that is highest ) folder is /config. I can’t go any higher than that (don’t need to also…).

Curious if others are experiencing slow behavior with the auto-checker? While typing, it’s auto-checking my stuff and then it turns red and generates an error - but then takes many seconds after correction before the red highlighting and stuff goes away.

File → Open folder… and then select root folder.
By default VSCode has the /config folder open I quess.
So, just change folder like normal in VSCode.

1 Like

Oh, thanks. Not that i need it right now, but you never know, right?

If I am running HA Supervised (because there are unrelatred but required host processes already running on the RPI) - headless connected via telnet or vnc to a windows machine - how do I use this or the equivalent, can someone point me in the right direction?

Maybe you should try just using VS Code on the windows client machine, with an SSH or SFTP extension. Of course in addition you need to be able to SSH/STP to Home Assistant.
EDIT: not sure if it works, haven’t had success yet.

1 Like

That would be great, the Windows 11 64 bit machine is 2 feet away from the RPI I can do SSH or STP or any protocol needed, they are both on ethernet on the same LAN segment, just wish I could find clear directions! You haven’t had success yet in that you ran into issues - ?

Check out this vs code extension: Home Assistant Config Helper - Visual Studio Marketplace

There you can find some info. The default ssh extension of vs code doesn’t work with rpi it seems.

Maybe you could try the SFTP vs code extension:

Or if you can access the files via Samba… Then use it to create a network drive of the config folder and mount it in Windows.

1 Like

I’ve got my VS Code on windows connecting via Remote - SSH - Visual Studio Marketplace (link contains good instructions for setting up and using it) to Raspberry Pi running the Lite (64-bit) no problem. You can use VS Code to also remotely have the extension for Home Assistant too. I edit directly there and upload/download individual files when required using the VS Code options of the extension above.

Hope that helps!

1 Like

Thanks but all these extra amounts and jumping through 12 hoops I think would take a lot longer than any convenience or time I would save… I do need to look into it though, only problem is a very busy at work and then also very busy with family and then the negative 10 hours of time I have left each day I could look into it… Thank you for the suggestions I will try to look into it if I ever get my head above water!

This seems like a little easier option possibly I’m going to bookmark this and check into it as soon as I can Thank you for the suggestion!

Is it possible to have an extension or simular to this great add-on to show live view of what the lovelace dashboard will look like?

What do you mean, running the Lite (64-bit)?

AFAIK there are some problems with using the Microsoft SSH extension for VSCode to remotely edit files on a Home Assistant OS that runs on Raspberry Pi. I didn’t get it to work myself and then later found this page.

I was remotely connecting to a Raspberry Pi 3 and 4 that was running Raspberry Pi OS 64-bit Lite headless.

At least in the early days with the SSH add-on it didn’t support connecting to the Raspberry Pi - all I know is that I installed the preview version of Remote SSH (linked in my original post) and that connected fine to the Raspberry Pi.

1 Like