Templating with fields: conversion

I have several thermostats activated with geofencing. When I set a thermostat, it often doesn’t accept the new value from the first attempt. So I have to set it a few times to the same value before it’s accepted.
I’ve created a script with 2 fields/variables and a loop until the new value is accepted in the thermostat. But I get an error on the conversion to float from the field.

alias: Set Temperature
sequence:
  - repeat:
      sequence:
        - service: climate.set_temperature
          data:
            temperature: "{{temperature}}"
          target:
            entity_id: climate.{{device}}
        - delay:
            hours: 0
            minutes: 0
            seconds: 6
            milliseconds: 0
      until:
        - condition: template
          value_template: >-
            {{states("sensor.room_setpoint_thermostat_""{{device}}") | float ==
            "{{temperature}}" | float}}  = true
    enabled: true
mode: restart
fields:
  device:
    selector:
      text: null
    name: Device
  temperature:
    selector:
      text: null
    name: Temperature
    default: "19"

The error:

Logger: homeassistant.helpers.script
Source: helpers/script.py:791
First occurred: 10:36:15
Last logged: 11:12:37
Error in ‘until[0]’ evaluation: In ‘template’ condition: ValueError: Template error: float got invalid input ‘unknown’ when rendering template ‘{{states(“sensor.room_setpoint_thermostat_”“{{device}}”) | float == “{{temperature}}” | float}} = true’ but no default was specified

How can I get the template to work properly?
THX

Don’t use template indicators {{}} inside templates, just use the variable name:

        - condition: template
          value_template: >-
            {{ states("sensor.room_setpoint_thermostat_"~device) | float == temperature | float}}

You are correct, It works!
THX!