Studio Code Server

me again…im still missing something fundamental here

Trying to pull pretty much copy paste of an example in instructions to create a scene on the fly.

Getting Message Malformed error.

But if I paste the code into VSC it all looks good, no red or errors. Why am i derping so much ? I still dont understand why VSC goes yay…and HA goes Nah

- alias: "Backdoor opened"
  trigger:
    - platform: state
      entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off
      from: 'off'
      to: 'on'
  condition: []
  action:
    - service: scene.create
      data:
        scene_id: temp_before
        snapshot_entities: climate.home_thermostat
    - service: climate.set_temperature
      target:
        entity_id: climate.home_thermostat
      data:
        temperature: '15'
- alias: "Backdoor closed"
  trigger:
  - platform: state
    entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off
    from: "on"
    to: "off"
  condition: []
  action:
  - service: scene.turn_on
    target:
      entity_id: scene.temp_before

VSC isn’t yelling at you because that’s valid YAML. That doesn’t mean its valid HA config though.

VSC’s validation is all based on schemas it applies to individual files. Which means it might be able to tell you if you’re looking at valid HA config according to HA’s schema if you are looking at configuration.yaml or a particular file it knows (like automation.yaml). I forget exactly the limitations. But as soon as you start going into random other files like test.yaml its not really going to be able to do more then just tell you whether or not its valid YAML since it wouldn’t know what schema to apply. Using VSC isn’t a replacement for running a config check, it mostly just prevents you from making YAML errors and can help with things like syntax highlighting, entity IDs and mdi icons. Well that and all the lovely things you’d expect from an IDE like multi-tabs, easy find and replace, terminal access, vim keybindings, etc.

As for your actual error. That looks like a valid automation but how is this random test.yaml file connected to configuration.yaml? I assume you have !include'ed it somewhere, how did you do that?

1 Like

Ahhhhhh…now that makes a lot of sense…thanks for clearing that up. Id added the HA plugin to VSC and assumed it would be able to check everything…that’s my misunderstanding.

The test.yaml is a red herring, just a blank file I created to paste my code in to ‘check’ it in VSC. Not being used anywhere at all.

Re the actual automation im trying to create its just a blank YAML file in the automations section. The wierd thing is if I remove the second part from -alias “Backdoor closed” down, and then remove the - at the first alias and shift everything over I can save it no problem and running just that bit works.

As soon as I try and add in the second bit when the door closes it wont let me save it…

EDIT…or am i being dumb and open and close should be 2 separate automations? Ive created them separately and they both work…I just cant get them in a single automation

It’s a struggle to get proper indention. I would just say after learning that I count my spaces in 2’s… always… so if I hit my spacebar I say in my head ‘1, 2’… then I know it’s correct. Sounds dumb but it works for me… if i see red I instantly know my indention is incorrect! :slight_smile:

1 Like

aye…just when I think ive ‘got it’ something like this comes up that makes me feel stupid again…ill get there with practice I guess :slight_smile:

1 Like

You will! I’m getting it myself so hang in there… :slight_smile: There will be times when you think you have then you don’t… LOL That’s the rollercoaster and that’s okay. Just step back a while and then come back at it.

Ask questions… but do web searches for ‘examples’ and/or look for the same question I’m sure someone else has answered it. You can search the forum. I’m pretty sure none of the problems we run into haven’t already been solved somewhere :slight_smile:

1 Like

Question about Studio Code Server and Git. Is there a blog or video about how to setup github with Studio code? Any support you’d recommend going to? I have been doing some research, but for some reason, a few did not work. Anyone gotten it to work?

Is this what you are after? Using GitHub Codespaces in Visual Studio Code - GitHub Docs

1 Like

I think that will do it. Thanks. Will work through it.

How do you save files on a mobile? When I click File menu it appears but menu is unresponsive