Home Assistant Community Add-on: Visual Studio Code

Similar issue here: VSCode add-on works fine when accessing HA via local IP address and port.
But when going through Nginx reverse proxy I get a blank screen. Otherwise everything seems to work fine, it’s just the VS Code add-on that doesn’t work.

When trying to access the VS Code add-on, the supervisor logs this error:
21-07-30 14:36:35 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 200, message='Invalid response status', url=URL('http://172.30.33.0:1337/?type=Management&reconnectionToken=55a462d9-6dee-4b2c-9a5f-5096aee41ffb&reconnection=false&skipWebSocketFrames=false')

Any clues towards how to resolve this are highly appreciated :slight_smile:

Got errors while trying to add new connection using extension SSH FS.
Suddenly i cannot change or add new SSH connection any more. I have tried everything.
“Could not connect to React dev server. Not running?”

Anyone have a clue?

Screenshot 2021-08-04 at 22-34-34 Visual Studio Code - Home Assistant

Hi Frenck you know what im missing in HA all the time a GITLAB-CI addon, you managed to make a lot of these great addons would it be an overkill to get a new usefull addon for project managment and maybe even versioning our configurations localy with that great gitlab sensor i see multiple uses.

I’m not able to start the VScode addon.
Using a odroid n2+ system with latest version of core.
When starting the webGUI I get a 401: Unauthorized

Otherwise this is a clean install.
Any idea’s on how to solve this?

Thanks in advance. See log below.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Visual Studio Code
 Fully featured VSCode experience, to edit your HA config in the browser, including auto-completion!
-----------------------------------------------------------
 Add-on version: 3.6.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 6.2  (aarch64 / odroid-n2)
 Home Assistant Core: 2021.8.7
 Home Assistant Supervisor: 2021.06.8
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to DEBUG
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] code-server.sh: executing... 
[cont-init.d] code-server.sh: exited 0.
[cont-init.d] mosquitto.sh: executing... 
[cont-init.d] mosquitto.sh: exited 0.
[cont-init.d] mysql.sh: executing... 
[cont-init.d] mysql.sh: exited 0.
[cont-init.d] user.sh: executing... 
[cont-init.d] user.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[10:21:51] INFO: Starting the code server...
[2021-08-22T08:21:52.200Z] info  Wrote default config file to ~/.config/code-server/config.yaml
[2021-08-22T08:21:53.067Z] info  code-server 3.11.1 c680aae973d83583e4a73dc0c422f44021f0140e
[2021-08-22T08:21:53.070Z] info  Using user-data-dir /data/vscode
[2021-08-22T08:21:53.102Z] info  Using config file ~/.config/code-server/config.yaml
[2021-08-22T08:21:53.102Z] info  HTTP server listening on http://0.0.0.0:1337 
[2021-08-22T08:21:53.102Z] info    - Authentication is disabled 
[2021-08-22T08:21:53.102Z] info    - Not serving HTTPS 

finally! found this on the discord by @gue (don’t know forum name).
Took hours to find this answer so posting it here for others to also enjoy :slight_smile:

Blockquote the ‘401: Unauthorized’ errors on Firefox go away (at least for me) when you disable the “Enhanced tracking protection” Enhanced Tracking Protection in Firefox for desktop | Firefox Help
See this issue: Ingress addons alunched from sidebar return 401: Unauthorized · Issue #7090 · home-assistant/frontend · GitHub

1 Like

Hey, not sur it’s a bug or me not having configured VScode correctly, so I try here first. I use VScode with an AZERTY keyboard, with all default settings. Undo is still bind to Cmd-Z (on a mac), but hitting the keys closes the opened tab as if Cmd-W was hit… Any idea what might be going on?
Thanks a lot!
Cheers

Newbie here I have been doing changes on my configuration.yaml restarting server and when trying to go back I always get the error “The connection was reset” and a white screen. I’m using Raspberry Pi 4 with 4GB. I have only been able to go back into Visual Studio Code uninstalling the Add-on

Not sure if this is the best place to post this question.
I use VS code for most of my file edits for yaml, config, ESPHome, etc.
But for my dashboards, I use the UI instead of yaml, with the occasional raw configuration editor.
So all my lovelace dashboards are in the hidden directory which does not show up in VSCode.

My question is, is there a way to force the hidden folders to show up in VSCode?

Thanks,
H-

1 Like

Has anyone noticed that the Visual Studio Code isn’t showing up in the add-on store…I also don’t see Wireguard either.

Are you looking in the “Community Add-on’s” section? They are there for me.

I really enjoy editing my config since I “discovered” the CS code addon and especially after configuring git properly.

The only thing which really bugs me: Some time after VS code auto saved a file, undo (Ctrl-z) doesn’t work anymore. Accoding to most of what I read about undo history issues, undo should work, even after a file was saved. And if it doesn’t, this is mostly related to a problem with an installed extension.

I have four extensions installed, but deactivating them doesn’t solve the issue:

  • C/C++
  • German language Pack
  • GitLens
  • Nano Themes

Actually, undo is still working immediately after auto save as long as I stay in the editor. But when I leave the VS code UI, f.e. for checking the config, reloading scripts etc. and returning some moments later, I can’t undo anything anymore.

Is this working for you or do you have the same issue?

Thanks for the help. Somehow the repository had been removed from my setup. I’ve readded it and can see everything now.

Is there any way to turn off the auto-indenting? It’s driving me absolutely bonkers, and I’ve tried turning it to “None” in User, Remote, and Workspace, but it’s still doing it!

Thanks!

1 Like

Visual Studio code will constantly crash my home assistant. If I’m coding in Visual Studio Code, at least 3 to 4o time sa day I’ll get trying to reconnect. If I disregard then home assistant freezes and I need to turn it off then back on. If I stop using Visual Studio Code then no crashes all day.
Am I the only one?

Could this have anything to do with it? https://medium.com/good-robot/use-visual-studio-code-remote-ssh-sftp-without-crashing-your-server-a1dc2ef0936d

Hi Paul - I’ve got the same issue running VS on an older PI3 with an SD card. The moment I try to use VS, it will crash or freeze HASS. Sometimes I can recover by clicking a different page, but while VS is installed, I noticed that even going to Supervisor will some make things freeze up.

The moment I uninstall VS code, everything works fine again. My next test is to run HASS.io on an SSD to see it’s maybe an issue with running HASS.io on a crapy SD card. It might be a PI3 thing. Haven’t had this issue on a PI4.

I am currently struggling with configuring Github in Visual Studio Code. I’m able to access my Github repository through the git command on the command line (git push --set-upstream https://[username]:[token]@github.com/[username]/[repository].git master
But how and where do I configure Git Username and Oauth Token in VS Code? When trying to commit through VS Code, the authentication fails and ends in an 404 error.

Update: Solved!

Solution:
Generate an Personal Access Token in Github
In VS Code call “Github: Set Personal Access Token” and set the Token

I am having the same problem.
@thorschtn Can you elaborate how you got it to work?

When trying to synchronize github from within VSCODE addon I get

I have created token using ssh-keygen and ssh-add and created the relevant token in github website.

ssh -T seems to work

ssh -vT also sees to work

Update:
I solved it by creating a key without a passphrase

scrolling in the home assistant mac app is not possible…

1 Like

Is there a trick configuring github for this addon? I set user name and email and add the remote repo for my files. When I am trying to push changes I’ll get a message box to allow access to github. A 2nd tab opens where I am able to grant access to the addon. But then github wants to redirect to the vs code instance and this ends in an error 404. I tried from local ip and using my duckdns domain but with no success.

Guys/Gals,

What am I missing here? I don’t see the “Visual Studio Code” when searching the addons page? I’ve watched a couple of youtube clips where the VSC is found and installed. I’m running the the ODROID N+ with HA OS.

Cheers!