Sensor value to the script

Hello.

How to pass sensor value select_rooms_for_clean to the script

script
 clean_select_rooms:
    alias: Clean selected
    sequence:
    - service: xiaomi_miot.call_action
      data:
        entity_id: vacuum.robot_cleaner
        siid: 7
        aiid: 3
        params:
          - states('sensor.select_rooms_for_clean')   #  there should be a value from the sensor!
          - 0      # 0 = 'Global'
          - 1      # 1 = 'start'
        throw: true # throw result to HA notifications
		
sensor:
  - platform: template
    sensors:
      select_rooms_for_clean:
        value_template: >
          {% set dfg = expand('group.all_rooms_for_vac_clean') | selectattr('state', 'eq', 'on')
          | map(attribute='entity_id') | list | join(',')
          | replace('input_boolean.bedroom_vacuum','14')
          | replace('input_boolean.kinozal_vacuum','12')
          | replace('input_boolean.hallway_vacuum','17')
          | replace('input_boolean.cabinet_vacuum','10')
          | replace('input_boolean.kitchen_vacuum','11') %}
            {{dfg}}
        friendly_name: "Rooms"
        icon_template: mdi:vacuum		

Use a template with {{…}} (if this is supported here). Currently your parameter is the String "states('sensor.select_rooms_for_clean')"

Thanks for the answer.
But it didn’t work out.

The script should work like this:

script
 clean_select_rooms:
    alias: Clean selected
    sequence:
    - service: xiaomi_miot.call_action
      data:
        entity_id: vacuum.robot_cleaner
        siid: 7
        aiid: 3
        params:
          - '10,12'   #  there should be a value from the sensor!
          - 0      # 0 = 'Global'
          - 1      # 1 = 'start'
        throw: true # throw result to HA notifications

What I want to do is not possible?

It does, but

doesn’t help to pinpoint why.

Trace of the script?
How does the template validate in the dev tools?