Slider to set timer (minutes)

Hi,

Is it possible to add a timer based on sliders?

Example timer:
timer_off_lrm:                                                                                                   
    alias: "Turn off ceiling light after preset minutes"                                               
    sequence:                                                                                                      
      - delay:                                                                                                     
          minutes: 33                                                                                              
      - service: homeassistant.turn_off                                                                            
        data:                                                                                                      
          entity_id: switch.light_dining_table 


Example Slider:
input_slider:                                                                                                      
  slider1:                                                                                                         
    name: Dining Table Light timer (minutes)                                                                             
    initial: 33                                                                                                    
    min: 0                                                                                                         
    max: 120                                                                                                       
    step: 5

How can I use the input of the slider in the timer script?

2 Likes

no one? Seems like a logical choice of usage :slight_smile:

hey @iaescwine,

I’m not sure if I’m understanding exactly what you’re trying to do … I think you try to add as delay time the value of an specific slider. Is that correct?

if so take a look to this thread, it might not be exactly the answer but might provide you some insights on how to do it:

hope this helps!

Thanks @davedan! That’s exactly what i meant :)!

I probably should use something like ->

value_template: ‘{ states.input_slider.slider1.state }’
minutes: ???

For now it’s not possible to use a value from a input_slider as a template for delay timers. I think it’s on planning, but not implemented yet.

1 Like

I’ve moved this to feature request in hope someone will catchup :slight_smile:

This is a duplicate of this feature request:

ah alright :slight_smile:

In 0.25 luckily it’s added :slight_smile:

timer_off_lrm: alias: "Ceiling light living room timer" sequence: - delay: minutes: '{{ input_slider.slider1 }}' - service: homeassistant.turn_off data: entity_id: switch.light_dining_table

and

delay: '00:{{ input_slider.slider1 }}:00'

Doesn’t work for me…

Am I missing something?

Did you got this working? If you did, can you post your code?
This would be a nice addition, to set a timer for my ceilingfan.

No still not working -_-"

Shouldn’t it be something like the following?

delay: '00:{{ states.input_slider.slider1.state | int }}:00'
2 Likes

Thanks @fanaticDavid I’ll check that and let you guys know :slight_smile:

@ThinkPad It works! :tada:
Thanks @fanaticDavid

You’re welcome! Happy to help :slight_smile:

Thanks for notifying!
Can you post your final code?

Any chance you could paste the working code formatted?

Here’s mine to turn off the coffee machine.

    kitchen_turncoffeemachine_off:
      alias: "Turn Off - CoofeeMachine"
      sequence:
        - delay: '00:{{ states.input_slider.coffeemachineshotdowndelay.state | int }}:00'
        - service: switch.turn_off
          data:
            entity_id: switch.relay1
2 Likes

Thank you!

Is there a way to define the value as seconds (for testing purposes)? I’ve tried the following but that doesn’t work.

#garden_water_timer:
#  alias: "Turn off garden water after x minutes"
#  sequence:
#    - condition: state
#      entity_id: input_boolean.water_timer
#      state: 'on'
#    - delay:
#        seconds: '00:{{ states.input_slider.timer_options_slider.state | int }}:00'
#    - service: switch.turn_off
#      entity_id: switch.ed01_relay1
#    - service: switch.turn_off
#      entity_id: switch.ed01_relay2