Passing variable as argument to script

Up until a few days ago, the following automation worked as expected, passing either ‘on’ or ‘off’ to the script. However, now it passes the text ‘trigger.to_state.state’. I haven’t made any meaningful change to the automation (and also reverted all changed to no avail), but I do believe the upgrade from 0.51 to 0.52 happened in that time frame.

What am I doing wrong?

Thanks

- alias: Activate boiler on schedule
  trigger:
    platform: state
    entity_id: calendar.boiler
  action:
    service: script.turn_on
    entity_id: script.toggle_boiler
    data:
      variables:
        state: trigger.to_state.state

You’re missing the curly brackets around.
state: '{{ trigger.to_state.state }}'

Thanks. I tried it with curly brackets in the past (both with data and date_template), but back then only this syntax worked. I also saw an example in one of the docs (that I can’t find anymore) with the syntax I currently have.
I’ll give the curly brackets another try, I guess.

I think it should be data_template. Automation Templating

You’re right. the combination of data_template and quotes around the template worked.
Thanks so much!