Template to int does not work

I’m using a input_select to control the number of runs of my vacuum.
The service needs an int as an input.

I tried the following code, but obviously it does not work.

What am i doing wrong?

When using the template editor i get the following.

put your template in double quotes.

Thank you!

Using that

              repeats: "{{ states('input_select.roborock_durchlaufe')}}"

in a card, its always corrected to

repeats: "{{ states('input_select.roborock_durchlaufe')}}"

and that does not work.

Any ideas?

I’m using a mushroom-template-card

You can’t template in the frontend

Thanks for your quick reply. What’s the solution? instead of calling a service, i need to call a script that calls the service?

Or is there another way to use an entity_state as an input for the repeats?

A script is probably the best way