Home Assistant Community Add-on: Visual Studio Code

What do you mean, running the Lite (64-bit)?

AFAIK there are some problems with using the Microsoft SSH extension for VSCode to remotely edit files on a Home Assistant OS that runs on Raspberry Pi. I didn’t get it to work myself and then later found this page.

I was remotely connecting to a Raspberry Pi 3 and 4 that was running Raspberry Pi OS 64-bit Lite headless.

At least in the early days with the SSH add-on it didn’t support connecting to the Raspberry Pi - all I know is that I installed the preview version of Remote SSH (linked in my original post) and that connected fine to the Raspberry Pi.

1 Like

Using the Visual Code Server, I changed the config_path to ‘/root’ on the config-page.
The setting is saved, but the Explorer on the left keeps the /CONFIG- map as the base-map.

What do I do wrong?

If you want to open another directory with Visual Studio code, go to File → Open folder (or something like that).

Hi
I have a question (may actually turn into more than one :slight_smile: for a few months my Studio Code Server addon has said that my templates has an error. I am new to .yaml code (any coding language to be honest).
have tried to find a solution in various forums. I hope this is where i can ask for help.
I my configuration.yaml I have: template: !include template.yaml
and my template.yaml have been like this:


(Edit: included code, thanks @ [sparkydave])

#template:
    - sensor:
        name: Seconds Today
        state_class: total
        unit_of_measurement: 'seconds'
        state: >
            {% set seconds_today = ((((now().hour*60)+now().minute)*60)+now().second) %}
            {% if seconds_today == 0 %}
                {{ 1 }}
            {% else %}
                {{ seconds_today }}
            {% endif %}

    - sensor:
        name: VUE all user sum 1Min
        state_class: total
        unit_of_measurement: 'W'
        device_class: power
        unique_id: VUE_all_summm_entity
        state: >
            {% set usage =
            states('sensor.opvaskemaskine_4_1min') | float +
            states('sensor.ovn_5_1min') | float +
            states('sensor.vandvarmer_6_1min') | float +
            states('sensor.kogeplade_fase_1_7_1min') | float +
            states('sensor.kogeplade_fase_2_8_1min') | float +
            states('sensor.kogeplade_fase_3_9_1min') | float +
            states('sensor.vaerksted_fase_1_10_1min') | float +
            states('sensor.vaerksted_fase_2_11_1min') | float +
            states('sensor.vaerksted_fase_3_12_1min') | float +
            states('sensor.vaskemaskine_13_1min') | float +
            states('sensor.clever_lader_fase_1_14_1min') | float +
            states('sensor.clever_lader_fase_2_15_1min') | float +
            states('sensor.clever_lader_fase_3_16_1min') | float %}
            {{ usage }}

    - sensor:
        name: Clever lader 1Min
        state_class: total
        unit_of_measurement: 'W'
        device_class: power
        unique_id: clever_lader_1min_3faser_entity
        state: >
            {% set clever = 
            states('sensor.clever_lader_fase_1_14_1min') | float + 
            states('sensor.clever_lader_fase_2_15_1min') | float + 
            states('sensor.clever_lader_fase_3_16_1min') | float %}
                {{ clever }}

    - sensor:
        name: Solar Generation 1Min
        state_class: total
        unit_of_measurement: 'W'
        device_class: power
        unique_id: solar_generation_1min_3faser_entity
        state: >
            {% set solar = 
            states('sensor.solcelle_fase_1_1_1min') | float + 
            states('sensor.solcelle_fase_2_2_1min') | float + 
            states('sensor.solcelle_fase_3_3_1min') | float %}
                {{ solar }}

    - sensor:
        name: Vaerksted forbrug 1Min
        state_class: total
        unit_of_measurement: 'W'
        device_class: power
        unique_id: vaerkssted_forbrug_1min_3faser_entity
        state: >
            {% set vaerksted = 
            states('sensor.vaerksted_fase_1_10_1min') | float + 
            states('sensor.vaerksted_fase_2_11_1min') | float + 
            states('sensor.vaerksted_fase_3_12_1min') | float %}
                {{ vaerksted }}

    - sensor:
        name: Kogeplade forbrug 1Min
        state_class: total
        unit_of_measurement: 'W'
        device_class: power
        unique_id: kogeplade_forbrug_1min_3faser_entity
        state: >
            {% set kogeplade = 
            states('sensor.kogeplade_fase_1_7_1min') | float + 
            states('sensor.kogeplade_fase_2_8_1min') | float + 
            states('sensor.kogeplade_fase_3_9_1min') | float %}
                {{ kogeplade }}
#

This: Incorrect type. Expected “array” is starting to… is… hmm, Any support is appreciated. :slight_smile:

Studio Code Server, Current version: 5.4.0
Home Assistant 2022.10.5
Supervisor 2022.10.0
Operating System 9.3
Frontend 20221010.0 - latest
Running on a NUC+Proxmox+VM for “Home Assistant OS VM”

Please post actual code rather than screenshots.

Thanks, it’s now included

why can’t i install visual code server on my pi3?
This add-on is not compatible with your device’s processor or the operating system you have installed on your device.

Hi, love the addon, one problem I am running into is I tried to configure git to use vscode as the editor by running

git config core.editor "code --wait"

However, when I try to run a git command like git rebase -i it fails with error Unknown option --wait. Tried searching online, but didn’t see anything about this. Any ideas how to fix this?

This isn’t the right topic for this (because it’s a yaml issue not an add-on issue) but the indenting jumped out at me. It should be:

  - sensor: # this line is needed only once

      - name: Sensor 1 # then each sensor in a list with a hyphen on the first line
        state: ...
        etc.

      - name: Sensor 2
        state: ...
        etc.

And so on.

2 Likes

Has anyone else found autocomplete function is really slow in VSCode? In comparison to the template editor autocomplete?

Is there a fix?

VSCode Example (about 3-10s for auto-complete to appear).
Screen Recording 2022-11-20 at 18.26.48

vs Template Editor which is almost instant.
Screen Recording 2022-11-20 at 18.27.14

1 Like

Thanks a lot for your support. Your suggestion solved it :slight_smile:

So entities suggestions doesn’t work for me. If I choose “Home Assistant” as language I get HA suggestions, if I choose “home-assistant-jinja” I get my entities, but not both at the same time.

Does anyone have this working with Github on a HAOS RPI4b install? No matter what I do, it will never finish the commit and push. I have changed http to 1 and the chunk size to 500mb and it still errors out. I have been rsyncing the files over to my windows laptop and using github desktop to get them onto github.

just noticed that VS Code is working again on Safari :upside_down_face:

grafik
Is this CPU load normal? reboot or restart doesn’t help…

What hardware are you using?

Raspi 4B, 8GB Ram

Recently (~1mo) I started noticing that the connection becomes unresponsive after opening VSCode for config edits. In a fresh tab it initially loads the last edited file and that’s fine. If I try to switch editing to some other file it just hangs. Everything becomes unresponsive.

Not running out of RAM on either HA machine or my browsing machine and addon seems to be idling.
image

Blockquote
[19:20:47] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:48] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:48] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:49] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:49] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:50] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:51] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:51] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:52] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:52] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:53] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:53] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:54] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:54] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:55] [172.30.32.2][9c964824][ManagementConnection] The client has reconnected.
[19:20:55] [172.30.32.2][84e902be][ExtensionHostConnection] <933> Extension Host Process exited with code: 0, signal: null.

Logs show frequent reconnections and eventually an exit.

My HA is running in a VM (4 cores & 8GB RAM) behind NPM + Cloudflare tunnel.

1 Like

I’ve been having exactly the same issue.

The last open file will reload, but the loading of new files, config directory all seem to hang.

I see the same log messages, but they don’t provide much useful info.

I’ve not been able to find a fix. I’ve switched back to using the File Editor add-on when I need to edit a file in browser.