Timer with duration based on slider

Dear all,

I am quite new to HA, but have managed to create some automations. I want to make a timer with variable duration based on the input of the slider. I have managed to create the slider and timer via the UI, but i can only enter a fixed duration of the timer, not one depending on the input of the slider. Can this be done via the UI or do I have to code this? If the latter is true, I have installed file editor but cannot find the yaml script(s) defining the timer that i created. They are not in the configuration.yaml or automations.yaml file.

Many thanks!

How is the timer going to be triggered ? Via a button on the UI ?

On this assumption, I’d create a button that then runs a script that takes the input_number value as a duration when starting the timer.

This thread is old but I think might still be relevant:-

You can get your entity id for the input_number (slider) from the same dialog you set it up in.

Thanks! It has gotten me a bit further, but it is still not working. I have made a timer helper, (in the UI) with duration 00:00:00 (timer.testtimer) and a slider (in the UI) to set the number of minutes (beregeningspomp_tijd_schuifregelaar). Furthermore, I have made a dummy switch helper and an automation that turns on a script after the dummy switch is turned on (all in the UI):

I have edited the YAML code of the script in File editor like this:

script_testtimer_starten:
  alias: script testtimer starten
  sequence:
  action: timer.start
  data:
    duration: "{{states('input_number.beregeningspomp_tijd_schuifregelaar')|int * 60}}"
  target:
    entity_id: timer.testtimer
  metadata: {}
  description: ''

However, turning the switch on does not start the timer. What am I doing wrong?

I’m not sure why you need an automation to trigger the script if you are just going to use a button on the UI to do this. This is an example of a button configured to run a script:-

If for some reason you need the automation, then post the automation code so we can see how its being triggered.