Home Assistant Community Add-on: Visual Studio Code

  1. In your profile, create a “Long-Lived Access Token” with any name you like. Copy immediately the generated token (you won’t be able to find it later).

  2. Select “visual studio code”. In the bottom left window click on the cog-wheel (Manage) and select entry “Settings”.

  3. Select the “User” tab, expand “Extensions” and select “Home Assistant Config Helper”. In “Host URL” enter your DuckDNS address: https://my_domain.duckdns.org (this assume you forwarded port 443 to port 8123). Do not check “Ignore Certificates”. In long-lived token, enter the token generated in first step. If you did not entered the information correctly, you will see pop-up error messages.

  4. Select the “Remote” tab, expand “Extensions” and select “Home Assistant Config Helper”. The information you have entered in the “User” tab should already be filled in. So nothing to do

  5. Select the “Workspace” tab, expand “Extensions” and select “Home Assistant Config Helper”. Perform same operation as in step 3: In “Host URL” enter your DuckDNS address: https://my_domain.duckdns.org (this assume you forwarded port 443 to port 8123). Do not check “Ignore Certificates”. In long-lived token, enter the token generated in first step. If you did not entered the information correctly, you will see pop-up error messages.

You are done. Since I did that, I (almost) never get the reload window message.

Hope this help

Jean

4 Likes

I’m getting an odd error in VSC (lights.yaml): Property state_template is not allowed.

Configuration validation shows no errors and the device (MQTT dimmer) works as expected.

Not sure how validation works in VSC. Is state_template deprecated?

Here’s the entire lights.yaml file:

- platform: mqtt
  schema: template
  name:  'Kitchen Table'
  state_topic: "shellies/shellydimmer2-12345678/light/0/status"
  state_template: '{% if value_json.ison %} on {% else %} off {% endif %}'
  command_topic: "shellies/shellydimmer2-12345678/light/0/set"
  command_on_template: '{"turn": "on"{% if brightness is defined %}, "brightness": {{(brightness | float * 0.3882 + 1) | round(0)}}{% endif %}}'
  command_off_template: '{"turn": "off"}'
  brightness_template: '{{ (value_json.brightness | float * 2.55) | round(0) }}'

Is it possible to get this working without SSL certificates at all? I actually only use a http://homeassistant:8123 URL in combination with a long life access token and always get the same error:

Error connecting to your Home Assistant Server at http://homeassistant:8123 and token 'eyJ0e...', check your network or update your VS Code Settings, make sure to (also) check your workspace settings! Error: ERR_CANNOT_CONNECT

There was some test website in the beginnen of this thread - that actually worked.

Thanks for you ideas?

PS: Yeah, I checked this twice, tried different tokens, tried with https and checked/unchecked the certificate checkbox…

:grinning: :grinning: :grinning:

I can’t believe it. I can confirm that it really seems to work. Many, many thanks for the workaround. :+1:

Edit: Damn, 10min later:
image

After the work around I was getting the problem only from time to time. But for the last two weeks I did not had it once. May be that the problem was fixed by something else? I ma currently learning HA and doing a lot of experiments and modifications.
I am crossing my fingers because this was a pain…

1 Like

In general: Should this addon work without certificates? Only http url?

I too can verify that @drcoolzic’s solution is working. At least no popups for me for a while now. Thanks!

I have the same “Cannot reconnect” problem and it started to happen lately. It was working correctly before. Isnt there any to use it without ssl? I use a local ip to access my HA in my network. I tried pi-hole for dns it works but i don’t wanna be under pihole all the time.

The “workaround” doesn’t help on my end at all. I actually had mine setup that way from day 1 trying to get the auto completion of entities. I still have to reload 4-5 times every time I start it.

@frenck
new install of .118.4 and cant get it to install,
404 Client Error: Not Found (“no such image: hassioaddons/vscode-amd64:2.8.2: No such image: hassioaddons/vscode-amd64:2.8.2”)

ANY IDEAS?

Updated to 2.9.0 this morning and haven’t had to reload yet today.
Still not getting entity autocomplete though :frowning:

Just updated. Autocomplete does not work, as the plugin cannot connect to HASS (see above). At least at my environment without SSL (however this might be unrelated to SSL).

Ham, sneaky question never asked before (well search is… a search machine, not a finding machine): any way wo run this great addon on an ARM based machine (Raspberry Pi)?

Editing YAML files in Notepad++ or File Editor add-On still is a pain at least because of missing autocomplete. :frowning:

ARM support was added a fair while back.

Nice to hear. But what are the specific requirements? 64 Bit OS?

Currently I get:

Hi,
can someone please tell me how I can disable this horribe auto indent feature in the Visual Studio Code add-on? This thing is driving me nuts.
Thanks!

Yes, I think you do need to be running the 64bit version, which is now the recommended one.

Luckily I switched HASS OS version to 64 bit today - and it is working. Needs a lot of RAM though, but that´s a massive improvement in editing yaml files.

Hi, it’s not perfect but as the official addon is disabled on my armv7 rpi3b (can’t install it with error message that the system is not supported), I made a simple vscode addon based on the linuxserver image here. Linuxserver images are precompiled docker images maintained by a specific community on wide range of apps and usually very stable.

Edit : just saw you switched to 64 bits. I’ll leave it, it might interest someone else :wink:

1 Like

Unfortunately I can’t. The bad auto-indent is annoying, and there’s a bug for it: