Script help using input helper slider

Hey everyone

I want ti use an input slider to set a variable value. Then press a button to call a script that will open a relay until a sensor reaches the value set on input slider. It will then close the relay

I’ve got the slider just can’t figure out how to use the value

You can use either wait_template or wait_for_trigger actions to do what you have asked:

script:
  example_script:
    sequence:
      - service: switch.turn_on
        entity_id: switch.relay_1
      - wait_template: "{{ states('sensor.1') >= states('input_number.1') }}"
      - service: switch.turn_off
        entity_id: switch.relay_1

Number helpers (input_number entities), number and sensor entities that contain a numeric value, can also be used in the above and below thresholds of numeric_state triggers, including those in wait_for_trigger actions:

script:
  example_script:
    sequence:
      - service: switch.turn_on
        entity_id: switch.relay_1
      - wait_for_trigger:
          - platform: numeric_state
            entity_id: sensor.1
            above: input_number.1
      - service: switch.turn_off
        entity_id: switch.relay_1

However, if you anticipate that the length of the wait will be more than a couple minutes, it will likely be better to turn it into an automation with multiple triggers and a choose action instead of relying on a wait.

Thanks for the reply it’s to control the fill of a water tank so I would imagine it not taking longer than about 5 - 10 minutes would the wait be suitable for this?