Need Help with Templates In script

I am using a custom card which calls a script and passes one variable in the form of an array.
This is how the card calls the script.turn_on service.

    service: script.turn_on
    target:
      entity_id: script.notify
    data:
      variables:
        rooms: 
            - room1
        repeats: 1
        predefined: false

In this script I want to check what is the value mentioned in the rooms variable and accordingly turn on a input_boolean.

for example if it is room1 them turn on input_boolean.kitchen
if its room2 then turn on input_boolean.hall

How can I do this?
I tried this

service: input_boolean.turn_on
target:
  entity_id: >-
    {% if '{{rooms}}'=="room1" %}
      input_boolean.kitchen
    {% elif '{{rooms}}'=="room2" %}
      input_boolean.hall
    {%endif%}

If it’s seperate rooms, that’s what areas are for, you could just assing an area to each entity and use area_entities, see this

Hi there this wont work in this particular case, the only way is to check the variable and choose the entity id of imput boolean.

Are you trying to add this service call to “script.notify” or a different script? In either case, please post the the actual script or scripts you are using. Without them we are just guessing at how it works.

But this will never work…

If “rooms” is a defined variable where you are trying to use it, you just use the variable name…

service: input_boolean.turn_on
target:
  entity_id: >-
    {% if rooms == "room1" %}
      input_boolean.kitchen
    {% elif rooms == "room2" %}
      input_boolean.hall
    {%endif%}

You can try this, but it’s just a guess because you haven’t shared the related script.

I am trying to add this the script.notify to which the variables are passed on to by the custom card.

This is not working as the variable is sent as an array. Please see how the card calls the service to run the script.

I have found the solution

service: input_boolean.turn_on
target:
  entity_id: >-
    {% if rooms[0] == "room1" %}
      input_boolean.kitchen
    {% elif rooms[0] == "room2" %}
      input_boolean.hall
    {%endif%}