Wrong escaping when passing area lists

I have the following script that allows for multiple areas to be passed:

service: script.climate_reset
data:
  room:
    - wohnzimmer
    - arbeitzimmer
    - kinderzimmer

The script accepts that field

fields:
  room:
    description: Raum
    required: true
    selector:
      area:
        entity:
          domain: climate
        multiple: true

And passes this on to another script

          - service: climate.set_hvac_mode
            data:
              hvac_mode: auto
            target:
              area_id: "{{ room }}"

So this looks like it should work. But now the script errors out because the arguments to set_hvac_mode are wrong. And it seems like they are templated out wrong. The trace shows the following:

params:
  domain: climate
  service: set_hvac_mode
  service_data:
    hvac_mode: auto
    area_id:
      - - wohnzimmer
        - arbeitzimmer
        - kinderzimmer
  target:
    area_id:
      - - wohnzimmer
        - arbeitzimmer
        - kinderzimmer

I also tried passing {{ room | list }} but this doesn’t work either. How can I make it that the argument to area_id is interpreted as array?

Ran into this same issue. Feels like a bug, because area_id does support arrays.
But a workaround is to use repeat.for_each or data_template.

So instead of:

- service: climate.set_hvac_mode
  data:
    hvac_mode: auto
  target:
    # List gets templated incorrectly
    area_id: "{{ room }}"

You can use data_template:

- service: climate.set_hvac_mode
  data_template:
    hvac_mode: auto
    area_id: "{{ room }}"

Or repeat:

- repeat:
    for_each: "{{ room }}"
    sequence:
      - service: climate.set_hvac_mode
        data:
          hvac_mode: auto
        target:
          # One area per service call
          area_id: "{{ repeat.item }}"