YAML line breaks

Hej, hass somehow always auto-breaks my automation.yaml and consequently breaks longer lines which ‘breaks’ my automations. that kinda sucks.

I tried the > multiline code to manually set breaks on longer commands, but there is an error. I think it has to do with the ’ ’ quotes not being able to extend over multiple lines?

How would i properly write this?

  - data_template:
      payload: >
      '{{ ["ok", "sure", "no problem", "done", "here you go",
      "turning {{trigger.event.data.state}}", "{{trigger.event.data.name}}
      lights are {{trigger.event.data.state}}"] | random}}'
    service: rest_command.rhasspy_speak

The error i get is

can not read a block mapping entry; a multiline key may not be an implicit key at line 22, column 60:
     ... event.data.state}}"] | random}}'
                                         ^

This seems to do. Probably wouldn’t have had to escape the double-quotes ", but what I overlooked were the additionally needed two spaces at the beginning of each line…

Last thing missing, is that rhasspy reads literally "left curly bracket left curly bracket trigger dot event dot… " and I am kinda running out of quotation marks to add some more. Any ideas how to properly format the template variables are more than welcome!

  - data_template:
      payload: >
        ''{{ [\"ok\", \"sure\", \"no problem\", \"done\", \"here you go\",
        \"turning {{trigger.event.data.state}}\",
        \"{{trigger.event.data.name}} lights are {{trigger.event.data.state}}\"]
        | random}}''
    service: rest_command.rhasspy_speak