VSCode error with time trigger offset

VSCode is throwing a fit with these two:

  - trigger: time
    at:
      entity_id: input_datetime.morning_light
      offset: -00:20:00
    id: turn_on
  - trigger: time
    at:
      entity_id: input_datetime.morning_light
      offset: 00:10:00
    id: turn_off

Incorrect type. Expected “array”.yaml-schema.

It was generated by HA automation GUI editor, I can’t see anything wrong with it at all.
It is also correct according to the docs:

Any idea how to stop VSCode from freaking out? Is there some minor edit I can do that is correct both for HA and VSCode schema?

Are you using the Studio Code add-on or stand alone VSCode?

Either way, ensure the Home Assistant Helper extension is up to date (or the add-on if that is what you are using). I just tried adding your trigger to one of my automations, no error.

1 Like

Sorry, I wasn’t clear. I’m using the Studio Code Server add-on. It is fully up to date at 5.19.3.
Home Assistant Config Helper is shown as Built-in.

The add-on configuration is at default.

Interesting you don’t get this syntax error. What else can I check with my addon or other HA configuration?

I just tried in the same version of the add-on (I was using stand alone desktop VSCode). I got no error there either.

1 Like

Is your extension up to date? Not addon, the extension in the addon.

For extensions, available update shown as 0.
and “All extension are up to date”

I’ve even uninstalled, checked delete data and clean re-installed the add-on.

In case it makes any difference, here is the full automation. I’ve looked at it many times, I can’t see anything wrong anywhere.

- alias: Aircon - Morning Bedroom Heating
  id: '1754172233015'
  description: ''
  triggers:
  - trigger: time
    at:
      entity_id: input_datetime.morning_light
      offset: -00:20:00
    id: turn_on
  - trigger: time
    at:
      entity_id: input_datetime.morning_light
      offset: 00:10:00
    id: turn_off
  conditions:
  - condition: state
    entity_id: sensor.home_presence_simple
    state: home
  actions:
  - choose:
    - conditions:
      - condition: trigger
        id:
        - turn_on

Feels like I’m going mad, those red lines really bothers me.

I don’t think you get any choice with that. It’s bundled with the add-on.

What happens if you quote the offset value?

  - trigger: time
    at:
      entity_id: input_datetime.morning_light
      offset: "-00:20:00"

It’s complaining about it not being a list/array. So this would likely fix it:

  - trigger: time
    at:
    - entity_id: input_datetime.morning_light
      offset: 00:10:00

I get a different error adding a dash. Wrapping offset with quotes doesn’t seem to do anything.

At this point, just ignore vscode and create the automation. Everything you’ve tried is valid yaml and only vscode is complaining about it.

Indeed only VSCode is complaining about it. But I don’t like to see red.

Anyway, I’ve changed my way of implementing this. Just single time trigger without offset. Use a delay in actions before turn off.

No more red warnings and still functions the same.

It comes bundled, but you can update it once it’s there.

It doesn’t even show up in my add-on.

Click built-in… after you click the filter symbol under extensions.

1 Like

Ah. That’s where it’s hiding. Thanks.

1 Like

How do I update it?

Looks like I have the same version as you though.

Presumably v1.43.0 is the latest?