Home Assistant Community Add-on: Visual Studio Code

This is a long shot but did you enter your host url and your long live token under settings-Extensions-homeassistant config-helper in vscode? That looks like my log when I first installed it on my system

Moreover, make sure you carefully copy the whole token. (I wasted about half an hour yesterday)
And the URL needs to be: https://ip:port (be careful of white-space - another 10 minutes wasted)

1 Like

First thanks to both of you.

As I said in my last post, since I have removed the NGINX add-on I do not see the problem anymore but I have tried your modifications

In User I have created a long-lived access token with the name of VSCode and I made a copy of the token

I clicked on the cog-wheel -> settings -> search config-helper. Clicked on the cog wheel of HA config helper and selected extension settings. Here I have a page with three tabs: User, Remote, and Workspace that looks like what you’re are taking about?

I first modified the User tab: in Host URL = https://my_local_ip:8123, I have checked Enable insecure transport, and I have entered the access token. After that, I was getting the following error message:

(node:2667)[DEPO123] Deprecation warning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in future version

I have therefore changed Host URL to https://my_domain.duckdns.org, and uncheck Enable insecure transport and after that it seems to work.

But

What is the benefit of entering this information if it works without these settings?

The usage of the three tabs is confusing if I modify info in User it also modify in Remote but not in Workspace?

If I remove information from User and Remote and if I place this info in Workspace the info seems to apply to the three tab?

At the end, I removed everything I added!

VScode_reconnect
Anyone have the solution to the reconnect issue?
Running duckdns with port forwarding to the server.
Reading the documentation there isn’t any other configuration for the add-on to build in long live token or anything. The issue consistent with few successful connections to remote host. Love VS code and use it for work and hobbies.

Thanks in advance!

I don’t recall the actual error but VScode was throwing an error related to this entry once I entered it it showed green as good and no longer received the error and I also used my duckdns url and that did it

  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: