Home Assistant Community Add-on: Visual Studio Code

Curious if others are experiencing slow behavior with the auto-checker? While typing, it’s auto-checking my stuff and then it turns red and generates an error - but then takes many seconds after correction before the red highlighting and stuff goes away.

File → Open folder… and then select root folder.
By default VSCode has the /config folder open I quess.
So, just change folder like normal in VSCode.

1 Like

Oh, thanks. Not that i need it right now, but you never know, right?

If I am running HA Supervised (because there are unrelatred but required host processes already running on the RPI) - headless connected via telnet or vnc to a windows machine - how do I use this or the equivalent, can someone point me in the right direction?

Maybe you should try just using VS Code on the windows client machine, with an SSH or SFTP extension. Of course in addition you need to be able to SSH/STP to Home Assistant.
EDIT: not sure if it works, haven’t had success yet.

1 Like

That would be great, the Windows 11 64 bit machine is 2 feet away from the RPI I can do SSH or STP or any protocol needed, they are both on ethernet on the same LAN segment, just wish I could find clear directions! You haven’t had success yet in that you ran into issues - ?

Check out this vs code extension: Home Assistant Config Helper - Visual Studio Marketplace

There you can find some info. The default ssh extension of vs code doesn’t work with rpi it seems.

Maybe you could try the SFTP vs code extension:

Or if you can access the files via Samba… Then use it to create a network drive of the config folder and mount it in Windows.

1 Like

I’ve got my VS Code on windows connecting via Remote - SSH - Visual Studio Marketplace (link contains good instructions for setting up and using it) to Raspberry Pi running the Lite (64-bit) no problem. You can use VS Code to also remotely have the extension for Home Assistant too. I edit directly there and upload/download individual files when required using the VS Code options of the extension above.

Hope that helps!

1 Like

Thanks but all these extra amounts and jumping through 12 hoops I think would take a lot longer than any convenience or time I would save… I do need to look into it though, only problem is a very busy at work and then also very busy with family and then the negative 10 hours of time I have left each day I could look into it… Thank you for the suggestions I will try to look into it if I ever get my head above water!

This seems like a little easier option possibly I’m going to bookmark this and check into it as soon as I can Thank you for the suggestion!

Is it possible to have an extension or simular to this great add-on to show live view of what the lovelace dashboard will look like?

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?