How to pass a string without changes to the script parameters

Hello
I’m sorry if I framed the question incorrectly.
I am trying to create a script for cleaning 1-5 rooms at a time, based on the included input boolean.
I use the integration “Xiaomi Mi Auto”, which has a service “xiaomi_miot.call_action”.
The basic working script looks like this:

clean_select_rooms:
  alias: bla
  sequence:
  - service: xiaomi_miot.call_action
    data:
      entity_id: vacuum.alice_vacuum_mop
      siid: 18
      aiid: 1
      params:
        - piid: 1
          value: 18
        - piid: 21
          value: '{"selects":[[3,1,1,3,1]]}'
      force_params: true

String “value:” may be:
value: ‘{“selects”:[[3,1,1,3,1],[1,1,1,3,1],[5,1,1,3,1]]}’
[3,1,1,3,1] - namber of room (1st 3) with other parameters.

I created a sensor and transmit its value to the script

2022-03-16_174121

sensor:
  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.halfhallway_vacuum','[2,1,1,3,1]')
      | replace('input_boolean.hallway_vacuum','[4,1,1,3,1]')
      | replace('input_boolean.bedroom_vacuum','[1,1,1,3,1]')
      | replace('input_boolean.livingroom_vacuum','[3,1,1,3,1]')
      | replace('input_boolean.childrensroom_vacuum','[5,1,1,3,1]')
      | replace('input_boolean.kitchen_vacuum','[6,1,1,3,1]') %}
        '{"selects":[{{dfg}}]}'

...
  - service: xiaomi_miot.call_action
    data_template:
      entity_id: vacuum.alice_vacuum_mop
      siid: 18
      aiid: 1
      params:
        - piid: 1
          value: 18
        - piid: 21
          value: "{{states('sensor.select_rooms_for_clean')}}"

Result:
value: “{{states(’‘sensor.select_rooms_for_clean’’)}}”

it add double quotes inside

I realized that this is due to the double quotes around the “select”

In the Template Editor, the string looks correct, but when the value is passed to the script, the syntax changes and nothing works

In the form in which it is, the quotation marks are removed:

selects:
- - 3
  - 1
  - 1
  - 3
  - 1

Adding any external quotes is converted to a string of the type:
“’{” selects":[[3,1,1,3,1]]}"’

Escaping internal quotes with backslashes and omissions:
'{\" selects\":[[3,1,1,3,1]]}'

Replaced the quotes with a Unicode number, recognized in the same way as the real ones, respectively, looks the same.

Added square brackets, line feed and dash addition:
value:
- '{"selects":[[3,1,1,3,1]]}'

Can anyone help with formatting?

change to


  - service: xiaomi_miot.call_action
    data_template:
      entity_id: vacuum.alice_vacuum_mop
      siid: 18
      aiid: 1
      params:
        - piid: 1
          value: 18
        - "{{ {'piid':21, 'value': states('sensor.select_rooms_for_clean') } }}"

Thank you very much. This is what I needed