Home Assistant Community Add-on: Visual Studio Code

I forwarded port 443 for the proxy to a different port (1234), because 443 is alreay in for an other application.
But I think it should work like this

I ran the debugger and the error I am seeing is with the websocket connection.

NGINX Config:

map $http_upgrade $connection_upgrade {
     default upgrade;
     '' close;
}

server {
     server_name homeassistant.example.net;
     listen 80;
   
     location /.well-known/acme-challenge/ {
          root /var/www/certbot;
     }

     location / {
          return 301 https://$host$request_uri;
    }
}

server {
     server_name homeassistant.example.net;
     ssl_certificate /etc/letsencrypt/live/homeassistant.example.net/fullchain.pem;
     ssl_certificate_key /etc/letsencrypt/live/homeassistant.example.net/privkey.pem;
     include /etc/letsencrypt/options-ssl-nginx.conf;
     ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
     listen 443;
     add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
     ssl_session_cache shared:SSL:10m;
     proxy_buffering off;

     location / {
          proxy_pass http://10.0.0.94:8123;
          proxy_set_header Host $host;
          proxy_http_version 1.1;
          proxy_set_header X-Real-IP $remote_addr;
	      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
     }

     location /api/websocket {
          proxy_pass http://10.0.0.94:8123/api/websocket;
          proxy_set_header Host $host;
          proxy_http_version 1.1;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
     }
 }

hass.io 0.91.4 fixed my issue.

2 Likes

Same for me

:tada: Release v0.4.0

Full Changelog

Again a packed release! :tada:

code-server has been upgraded to the latest greatest, shipping vscode 1.33.1 as well.
Service workers are added and a bunch of more optimizations, which should drastically reduce the initial loading times of the web interface.

@timmo001 added an option to disable sending anonymous telemetry data to code-server and @hjanum added a small change that makes AppDaemonā€™s dash files being picked up as YAML as well.
@riemers came by and added support for RedHatā€™s YAML extension, which validates you YAML files while typing them. :100:

The default user settings are tweaked for more logical and better user experience for working on Home Assistantā€™s configuration files and support for Home Assistantā€™s special YAML tags has been added. If you havenā€™t modified the default vscode configuration, the add-on will automatically upgrade these settings for you.

Finally, all command history from the built-in terminal will now persist across add-on restarts and system reboots. Which helps to find that command you used beforeā€¦

Enjoy the release!

Changed

  • :arrow_up: Update code server to 1.868-vsc1.33.1 (#27) (@timmo001)
  • :hammer: Adds disable telemetry flag (#27) (@timmo001)
  • :hammer: Adds disable telemetry as an option (#27) (@timmo001
  • :sparkles: Adds vscode YAML extension (#26) (@riemers)
  • :sparkles: Adds *.dash extension for YAML (#24) (@hjanum)
  • :sparkles: Adds user configuration upgrade method
  • :books: Updates README about section to match latest changes
  • :sparkles: Persist userā€™s ZSH history across restarts
  • :hammer: Tweaked default user settings for a better starting experience
  • :shirt: Fixes JSON lint issue

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

5 Likes

update VScode v4, now my panel_ iframe doesnā€™t work. What do I need to add to the config of panel_iframe. Iā€™m work with Home Assistant 0.91.4. Thanks

  vscode:
    title: Visual Studio Code
    icon: mdi:visual-studio-code
    url: http://192.168.1.120:1337/

make sure you add port 1337 in the network section and it will work

Thank you David, that worked

1 Like

As @DavidFW1960 said, if you re-assign a port to it, the iframe will continue to work the old way.

However it stopped working because this addon now supports ingress. If you wait until 0.92, there will be a simple checkbox to add an ingres addon to the sidebar. If you do not want to wait, below is a code section to add the addon to the sidebar using ingress.

Ingress works without exposing extra ports to the outside, so using it thereā€™s no need to enable port 1337 again, and no need to forward that port on your router for remote usage.

panel_custom:
  - name: hassio-main
    sidebar_title: Visual Studio Code
    sidebar_icon: mdi:visual-studio-code
    js_url: /api/hassio/app/entrypoint.js
    url_path: vscode
    embed_iframe: true
    require_admin: true
    config:
      ingress: a0d7b954_vscode

Also note, all of this information was already available in change logs, upgrade notes, and version notes.

1 Like

Can someone point me to the settings file?
I made a change and would very much like to restore to default settings. (I made it unusableā€¦)
I tried reinstalling end removing the container. But that didnā€™t help

Click on the default button at the bottom of the settings, also at bottom of network. Restart addon

Thanks for the tip, but sorry canā€™t even find that button.
Somehow I believe I clicked ā€œshow in finderā€ when focussed on my zwave.xml file:


Now I canā€™t get rid of it anymore.

Ah, you meant those. No luck Iā€™m afraid. These are the settings for the add-on itself. Iā€™m looking for the settings inside the add-on that will help me get rid of the problem. Re-install and removing docker container/image donā€™t help.
There must be a config stored on the NUC somewhere.

Well I donā€™t understand what you canā€™t do because that screenshot looks fine to me

Sovled it, Clearing browser cache did the trickā€¦

:tada: Release v0.4.1

Full Changelog

This is a maintenance release that upgrades code-server and addresses an issue with open dialogs.

Changed

  • :arrow_up: Updates code-server to 1.903-vsc1.33.1 (#29) (@timmo001)

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

:tada: Release v0.4.2

Full Changelog

:sparkles: This release adds support for the ā€œAdd to sidebarā€ feature that became available in Home Assistant 0.92.

Please note: You need to have Home Assistant 0.92 or newer to be able to install this update.

:hammer: Changed

  • :arrow_up: Updates Home Assistant requirement to 0.92.0b2
  • :sparkles: Adds support for showing in sidebar

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

Hello!

I am running version 0.92.0 of hass.io on a Raspbian Stretch. I am able to install official addons as well as communitiy addons, but only Visual Studio Code is greyed-out and I cannot install it (see screenshot below). It says ā€œThis add-on is not available on your system.ā€

Iā€™ve also tried this with the official hass.io ā€œRaspberry Pi 3 Model B and B+ 32bitā€ image - same problem.

Any ideas?

VS Code add-on runs on x64 systems only

1 Like