Home Assistant Community Add-on: Visual Studio Code

http://ip-address:1337 gives the NGINX error 403 as per above log

Memory usage and general performance have been improved significantly!

Awesome work on this, it was so slow before that I almost gave it up, now it’s useable for me! I have quite the old nuc…

1 Like

Thanks! Do you think this “a0d7b954_vscode” is going to stay the same?

Yes, that is the add-on slug and is not changeable.

I guess so… don’t see why it wouldn’t

I have also issues to start the vscode and web SSH und via my Duck DNS/Lets Encrypt ngnix configuration. I get only a dark grey screen, but the app is not loading. With the “configurator” Addon + ingress its working fine. The path looks also a little different.

SSH path: https://xxxxx.duckdns.org:1234/hassio/ingress/a0d7b954_ssh not working
Configurator path: https://xxxxx.duckdns.org:1234/hassio/ingress/core_configurator working

Local its working. ( http://192.168.2.25:8123/hassio/ingress/a0d7b954_ssh )
Via nabu casa cloud its working, too. ( https://xxxxxxxxxxxxxxxxxxxxx.ui.nabu.casa/hassio/ingress/a0d7b954_vscode)

Whats the problem??

Are you showing a dummp port number? can’t both be 1234

Its only a placeholder but the port is nevertheless the same. I thought that is manged via ingress?! Its my HA port for the proxy

I don’t specify a port at all for my proxy. Caddy sees the subdomain and then forwards to ipaddress:port… I never specify a port in the proxt url
So I can go to

 https://xxxxx.yyyyy.duckdns.org/hassio/ingress/a0d7b954_ssh

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