Studio Code Server

Is it worth making the switch from the inbuilt File editor?

I like the way it shows spacing errors better etc, but im having a hard time getting all the red from VSC. If I fix some of the red bits I fail config check on bits that are clearly working ???

Was looking for something to help as I get to grips with YAML but this confuses me more if its marking things wrong that are not wrong…

It is definitely worth it.

2 Likes

I did the switch and never looked back :wink:

1 Like

Honestly, I use both. The File Editor addon I use on my phone as it renders way way way better on mobile devices then the studio code server… The studio code server I use when I have an actual computer with a keyboard and mouse in front of me.

2 Likes

cool ill push on then…is it expected to have these little anomalies where VSC thinks there is an error and HA doesnt ?

I guess HA always wins if so

Always validate your config before restart and you will be fine :wink:

1 Like

case in point VSC shows these as being wrong, if i correct them so they are not red in VSC I fail config check,

image

just a quirk to get used to?

1 Like

Your indentation needs to be consisitent, so the second screenshot is wrong (or it looks that way). you have two spaces indentation mainly, but it looks like one space after data

1 Like

That’s not a quirk. You actually have inconsistent indentation. Indentation is important in YAML.

cunsomize: should be indented one space further out which will mean your binary sensor entity_ids need to be two spaces further out. Same for all your device_classes, though they will now have to be 3 spaces further out because of the previous changes. See how the spacing correction trickles down to the items below?

Being reminded to use consistent indentation is one advantage of using VSCode.

3 Likes

Yep and much easier to see those screenshots on my laptop than my tablet.

Having said that, it is better not to post screenshots on text. Try copy & paste, it has been around a while :slight_smile:

1 Like

?

Copy and paste wouldnt show the red I was talking about which was my question, so thought an image would work better .

Ill try the spacing again…what I found odd was when I spaced it in VS and got an ‘all clear’ and no red, HA then failed it on config check. Ill try again…it’s the reason VSC seems like the better option to pick up on these little things, just need to get to a point where both it and HA agree :slight_smile:

Thanks @Tom_in_HI , fixed the customize portion thanks to your guidance. Im still struggling with the end section tho, I can get VSC to show no errors like this (which tbh doesn’t look right to me)

image

but HA is nope…

Thats what is tripping me up, that VSC says its good, but it’s not.

I have tracked down a nice little YAML spacing for noobs course on YT that im off to watch so I dont have to completely rely on VSC and me putting random spaces in until it’s not red :wink:

I fixed it :slight_smile:
Got a green / green with this -

#switches
switch:
  - platform: wake_on_lan
    mac: B4-2E-99-D1-C8-64
    name: "andys_pc"
    host: 192.168.50.123
    turn_off:
      service: hassio.addon_stdin
      data:
        addon: core_rpc_shutdown
        input: "andys_pc" 

Not completely sure I understand why at this stage, but im learning :slight_smile: Thanks for your help everyone, ill push forward with VSC now

1 Like

Do you have the Home Assistant Config Helper extension?

That extension will highlight issues with your config.

At the moment it looks like all you have is the rainbow indent extension.

1 Like

Sorry I thought you meant the red text.

1 Like

I do now!! OK, i get it now…VSC totally makes this so much easier. Makes a noob like me feel like they know what they are doing. :wink:

Thanks for your help again

I have another question… :wink:

Can I use VSC to edit the other parts of my setup? (dashboards etc, cards etc) or is it just integrated with the front end config files ?

You can use it to edit dashboards if you use yaml mode instead of the UI. I wouldn’t recommend it for a beginner.

https://www.home-assistant.io/dashboards/dashboards/#using-yaml-for-the-default-dashboard

You can edit any other file in your config folder including for ESPHome.

1 Like

Gotcha…I’ll learn to walk first :wink:

Just wondered if I was missing a way to open edits in VSC as I find myself more and more using custom cards that have no UI so really end up just editing the RAW dashboard code from the top right menu.

You can always edit in VSCode then copy and paste to a manual card. It’s what I do for more complicated frontend card configuration.

1 Like