String does not match the pattern of "LEGACY_SYNTAX"

Hi,

I have this in my templates.yaml file :

- trigger:
    - trigger: event
      event_type: event_template_reloaded
    - platform: state
      entity_id: 
        - weather.owm_onecall_daily
    - platform: time_pattern
      hours: /1
  action:
...

Works fine, but why do I get these errors in Studio Code Server ?

Because you are using a mix of old and new syntax.

The modern syntax is:

- triggers:
    - trigger: event
      event_type: event_template_reloaded
    - trigger: state
      entity_id: 
        - weather.owm_onecall_daily
    - trigger: time_pattern
      hours: /1
  conditions:
    - condition: ...
  actions:
    - action: ...

lmgtfy… Search results for '"LEGACY_SYNTAX" order:latest' - Home Assistant Community

Tom,

Seems there is still a problem :

- triggers:
    - trigger: event
      event_type: event_template_reloaded
    - trigger: state
      entity_id: 
        - weather.owm_onecall_daily
    - trigger: time_pattern
      hours: /1
  conditions: []
  actions:
    - action: weather.get_forecasts
      data:
        type: daily
      target:
        entity_id: weather.owm_onecall_daily
      response_variable: daily
  sensor:
    - name: OpenWeatherMap Forecast Cloud coverage
      unique_id: openweathermap_forecast_cloud_coverage
      state: "{{ daily['weather.owm_onecall_daily'].forecast[0].cloud_coverage }}"
      unit_of_measurement: "%"

Seems this is the solution :slight_smile:

- trigger:
    - trigger: event
      event_type: event_template_reloaded
    - trigger: state
      entity_id: 
        - weather.owm_onecall_daily
    - trigger: time_pattern
      hours: /1
  action:

I’m guessing Studio Code has not caught on to the latest changes to trigger based template sensors. The conditions should be possible.

What version of the Home Assistant Config Helper extension are you using?

Where do I find that ?

I install all updates, so I should be up-to-date with everything I presume.

The version of Studio Code Server is 5.19.3

Are you using the add-on or desktop version of VSCode?

I use the Add-on

Oops. Yeah for template sensors it is trigger not triggers.

Bit of an inconsistency there compared to the syntax used in automations.