Roborock custom script and cards - question

Roborock s7 maxV.
followed this amazing guide and theme:
🟣 Rounded - Dashboard guide - #2 by LE0N + the help of @CM000n user, i try to complete “Vacuum zones” card.
after i toggle which rooms i want to clean,we press “vacuum zones”

my problem is to implement the segments, as the creator of this section created this for another robot, so its customs yaml code with room id’s.
how can I implement this with room’s that we have from map extractor?

alias: Vacuuming of selection
icon: mdi:robot-vacuum
sequence:

  • service: script.turn_on
    target:
    entity_id: script.vacuum_clean_segments_message
    data:
    variables:
    segments: >-
    ** {{expand(“group.vacuum_rooms”) | selectattr(“state”,“eq”,“on”) |**
    ** map(attribute=“attributes.room_id”) | list | to_json}}**
    iterations: >-
    {{states(‘input_number.general_robot_vacuum_cleaner_zone_repetitions’)}}
  • if:
    • condition: state
      entity_id: input_boolean.living_room_select_cleaning
      state: “on”
      then:
    • service: input_datetime.set_datetime
      target:
      entity_id: input_datetime.living_room_last_cleaned
      data:
      date: “{{ now().strftime(’%Y-%m-%d’) }}”
  • if:
    • condition: state
      entity_id: input_boolean.kitchen_select_cleaning
      state: “on”
      then:
    • service: input_datetime.set_datetime
      target:
      entity_id: input_datetime.kitchen_last_cleaned
      data:
      date: “{{ now().strftime(’%Y-%m-%d’) }}”
  • if:
    • condition: state
      entity_id: input_boolean.bed_room_select_cleaning
      state: “on”
      then:
    • service: input_datetime.set_datetime
      target:
      entity_id: input_datetime.bed_room_last_cleaned
      data:
      date: “{{ now().strftime(’%Y-%m-%d’) }}”
  • if:
    • condition: state
      entity_id: input_boolean.toilet_select_cleaning
      state: “on”
      then:
    • service: input_datetime.set_datetime
      target:
      entity_id: input_datetime.toilet_last_cleaned
      data:
      date: “{{ now().strftime(’%Y-%m-%d’) }}”
  • if:
    • condition: state
      entity_id: input_boolean.bath_room_select_cleaning
      state: “on”
      then:
    • service: input_datetime.set_datetime
      target:
      entity_id: input_datetime.bath_room_last_cleaned
      data:
      date: “{{ now().strftime(’%Y-%m-%d’) }}”
  • if:
    • condition: state
      entity_id: input_boolean.toilet_select_cleaning
      state: “on”
      then:
    • service: input_datetime.set_datetime
      target:
      entity_id: input_datetime.toilet_last_cleaned
      data:
      date: “{{ now().strftime(’%Y-%m-%d’) }}”
  • if:
    • condition: state
      entity_id: input_boolean.hallway_select_cleaning
      state: “on”
      then:
    • service: input_datetime.set_datetime
      target:
      entity_id: input_datetime.hallway_last_cleaned
      data:
      date: “{{ now().strftime(’%Y-%m-%d’) }}”
  • if:
    • condition: state
      entity_id: input_boolean.guest_room_select_cleaning
      state: “on”
      then:
    • service: input_datetime.set_datetime
      target:
      entity_id: input_datetime.guest_room_last_cleaned
      data:
      date: “{{ now().strftime(’%Y-%m-%d’) }}”
  • if:
    • condition: state
      entity_id: input_boolean.office_select_cleaning
      state: “on”
      then:
    • service: input_datetime.set_datetime
      target:
      entity_id: input_datetime.office_last_cleaned
      data:
      date: “{{ now().strftime(’%Y-%m-%d’) }}”
  • service: input_boolean.turn_off
    target:
    entity_id:
    - input_boolean.living_room_select_cleaning
    - input_boolean.kitchen_select_cleaning
    - input_boolean.bed_room_select_cleaning
    - input_boolean.bath_room_select_cleaning
    - input_boolean.toilet_select_cleaning
    - input_boolean.hallway_select_cleaning
    - input_boolean.guest_room_select_cleaning
    - input_boolean.office_select_cleaning
    data: {}
  • service: input_number.set_value
    data:
    value: 1
    target:
    entity_id: input_number.general_robot_vacuum_cleaner_zone_repetitions
    mode: single