Use template in script where int is required

I am trying to use an input slider to control a scrip minutes configuration.

pool_timer:
  alias: "1h pool timer"
  sequence:
  - delay:
      minutes: '{{ int(states("input_slider.slider1")) }}'
  - service: switch.turn_off
    data:
      entity_id: switch.Pool_Pump

I get the following error:

homeassistant.bootstrap: Invalid config for [script]: expected int for dictionary value @ data['script']['pool_timer']['sequence'][0]['delay']['minutes']

so obviously it expects an int and is receiving something else. However i have typecast the template to an int, but it still has the issue.

anyway to make this work?

Template is currently not supported for delay.

1 Like

thanks, i have added my vote.

Hi Palitu,

You can now achieve this with templating.

delay: '00:{{ states.input_slider.minute_delay.state | int }}:00'

Rich

1 Like