Getting Legacy Syntax error on my config

Hi everyone,

I am getting a Legacy Syntax error on my code. Here is the code

- platform: template
  name: Garage Door
  value_template: "{{ is_state('binary_sensor.garagedoor_sensor', 'off') }}"
  lock:
    service: switch.toggle
    target:
      entity_id: switch.garagedoor_switch
  unlock:
    service: switch.toggle
    target:
      entity_id: switch.garagedoor_switch

On the service: switch.toggle lines I am getting the error “String does not match the pattern of “LEGACY_SYNTAX^”.”

Not sure how to fix this? Any help would be appreciated.

Cheers.

Are you seeing that while editing the file using the Visual Studio Code Add-on?

If so, you can safely ignore it. The Add-on uses an outdated validation plug-in that needlessly complains about things that are still supported by Home Assistant.

If you don’t want to ignore it, change service: to action:

If you have the time, you should consider converting your Template Lock’s configuration to modern format (it’s currently in legacy format). Refer to the documentation for more details.

Hi Taras,

Ah no worries. Thank you very much for the info!

1 Like