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
davedan
(Dave Dan)
June 12, 2016, 4:43pm
3
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:
I didn’t find a component to create an alarm clock for my difficult morning, so i implement that.
It’s composed with simple modules
input_boolean :
reveil:
name: Reveil positionné
initial: off
icon: mdi:alarm
lightreveil:
name: Reveil Naturel
initial: off
icon: mdi:theme-light-dark
We declare 2 input_boolean to turn on the TV and to turn on bedroom’s light
input_select:
choixreveil:
name: "reveil matin"
icon: mdi:alarm
initial: "06:35"
op…
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
This is a duplicate of this feature request:
Hello, I want to create a script with a configurable delay but I can’t figure out how to correctly define it.
I tried the following using templating:
countdown_run:
alias: 'Countdown running'
sequence:
- delay:
minutes: '{{states.input_select.timeout_delai.state|int}}'
...
But I end up with this error :
ERROR:homeassistant.bootstrap:Invalid config for [script]: expected int for dictionary value @ data[‘script’][‘countdown_run’][‘sequence’][0][‘delay’][‘minute…
In 0.25 luckily it’s added
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.
iaescwine
(Ashwin)
August 20, 2016, 5:29pm
12
No still not working -_-"
Shouldn’t it be something like the following?
delay: '00:{{ states.input_slider.slider1.state | int }}:00'
2 Likes
iaescwine
(Ashwin)
August 21, 2016, 10:10pm
14
Thanks @fanaticDavid I’ll check that and let you guys know
iaescwine
(Ashwin)
August 22, 2016, 9:00pm
15
You’re welcome! Happy to help
Thanks for notifying!
Can you post your final code?
xbmcnut
(xbmcnut)
October 14, 2016, 4:38am
18
Any chance you could paste the working code formatted?
davedan
(Dave Dan)
October 14, 2016, 7:39pm
19
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
xbmcnut
(xbmcnut)
October 15, 2016, 1:28am
21
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