- alias: Sprinker Time Zone 01
trigger:
platform: state
entity_id: switch.01_pro_switch_1
to: 'on'
action:
service: homeassistant.turn_on
entity_id: script.timed_sprinkler_01
- alias: Sprinker Time Zone 02
trigger:
platform: state
entity_id: switch.01_pro_switch_2
to: 'on'
action:
service: homeassistant.turn_on
entity_id: script.timed_sprinkler_02
- alias: Sprinker Time Zone 03
trigger:
platform: state
entity_id: switch.01_pro_switch_3
to: 'on'
action:
service: homeassistant.turn_on
entity_id: script.timed_sprinkler_03
script:
timed_sprinkler_01:
alias: "Set Sprinkler Timer Zone 01"
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.timer_off
# Set new timer
- service: script.turn_on
data:
entity_id: script.timer_off
timer_off_01:
alias: "Turn Off Sprinkler Zone 01"
sequence:
- delay: '00:00:{{ states.input_slider.slider1.state | int }}'
- service: homeassistant.turn_off
entity_id: switch.01_pro_switch_1
timed_sprinkler_02:
alias: "Set Sprinkler Timer Zone 02"
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.timer_off
# Set new timer
- service: script.turn_on
data:
entity_id: script.timer_off
timer_off_02:
alias: "Turn Off Sprinkler Zone 02"
sequence:
- delay: '00:00:{{ states.input_slider.slider2.state | int }}'
- service: homeassistant.turn_off
entity_id: switch.01_pro_switch_2
timed_sprinkler_03:
alias: "Set Sprinkler Timer Zone 03"
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.timer_off
# Set new timer
- service: script.turn_on
data:
entity_id: script.timer_off
timer_off_03:
alias: "Turn Off Sprinkler Zone 03"
sequence:
- delay: '00:00:{{ states.input_slider.slider3.state | int }}'
- service: homeassistant.turn_off
entity_id: switch.01_pro_switch_3
input_number:
slider1:
name: Sprinkler Time Zone 01
initial: 10
min: 1
max: 30
step: 1
slider2:
name: Sprinkler Time Zone 02
initial: 10
min: 1
max: 30
step: 1
slider3:
name: Sprinkler Time Zone 03
initial: 10
min: 1
max: 30
step: 1
This is what I have along with the switch, I was wondering why I can’t seem to get any of this to work. I think I copied this from an old thread possibly. If I hit the slider it doesn’t turn the switch on. Execute the Timer nothing. Is there somehting Im not linking properly?
Oh and I used the </> and the formating is off, but all is indented corrrectly. I just can’t seem to get the few first ones right. Haha sorry
The delay portion looks off. I pulled the following from the script docs. The first example seems to be the simplest.
# Waits however many seconds input_number.second_delay is set to
- delay:
# Supports milliseconds, seconds, minutes, hours, days
seconds: "{{ states('input_number.second_delay') }}"
# Waits however many minutes input_number.minute_delay is set to
# Valid formats include HH:MM and HH:MM:SS
- delay: "{{ states('input_number.minute_delay') | multiply(60) | timestamp_custom('%H:%M:%S',False) }}"
If you use trigger.entity_id you could actually have one automation to turn on all solenoids rather than one automation for each on, and then another for off. E.g. 2 automations for the control, than than 2y (8)
e.g.
- alias: Sprinker Time Zone 1_4
trigger:
- platform: state
entity_id: switch.01_pro_switch_1
to: 'on'
- platform: state
entity_id: switch.01_pro_switch_2
to: 'on'
- platform: state
entity_id: switch.01_pro_switch_3
to: 'on'
- platform: state
entity_id: switch.01_pro_switch_4
to: 'on'
action:
{%- if (trigger.entity_id == "switch.01_pro_switch_1") %}
service: homeassistant.turn_on
entity_id: script.timed_sprinkler_01
{%- elif (trigger.entity_id == "switch.01_pro_switch_2") %}
service: homeassistant.turn_on
entity_id: script.timed_sprinkler_02
{%- elif (trigger.entity_id == "switch.01_pro_switch_3") %}
service: homeassistant.turn_on
entity_id: script.timed_sprinkler_03
{%- elif (trigger.entity_id == "switch.01_pro_switch_4") %}
service: homeassistant.turn_on
entity_id: script.timed_sprinkler_04
{%- else %}
service: homeassistant.turn_on
entity_id: script.do_nothing
{%- endif %}
I have changed to something simpler following the automation in the wiki.
So everything displays correctly in the frontend, but when the timer finishes it doesn’t turn the switch off… Is there something I’m not putting into the automation?
zone01_01:
name: Time Left
duration: '00:01:00'
zone02_01:
name: Time Left
duration: '00:01:00'
zone03_01:
name: Time Left
duration: '00:01:00'
zone01_05:
name: Time Left
duration: '00:05:00'
zone02_05:
name: Time Left
duration: '00:05:00'
zone03_05:
name: Time Left
duration: '00:05:00'
zone01_10:
name: Time Left
duration: '00:10:00'
zone02_10:
name: Time Left
duration: '00:10:00'
zone03_10:
name: Time Left
duration: '00:10:00'
####################################################
# #
# Irrigation #
# #
####################################################
################ 1 Minute #########################
- alias: Timer 1 Minute Zone 01
# Timer is started when the switch pumprun is set to on.
trigger:
platform: state
entity_id: switch.01_pro_switch_1
to: 'on'
action:
service: timer.start
entity_id: timer.zone01_01
- alias: Timer 1 Minute Zone 02
# Timer is started when the switch pumprun is set to on.
trigger:
platform: state
entity_id: switch.01_pro_switch_2
to: 'on'
action:
service: timer.start
entity_id: timer.zone02_01
- alias: Timer 1 Minute Zone 03
# Timer is started when the switch pumprun is set to on.
trigger:
platform: state
entity_id: switch.01_pro_switch_3
to: 'on'
action:
service: timer.start
entity_id: timer.zone03_01
################ 5 Minutes #########################
- alias: Timer 5 Minutes Zone 01
# Timer is started when the switch pumprun is set to on.
trigger:
platform: state
entity_id: switch.01_pro_switch_1
to: 'on'
action:
service: timer.start
entity_id: timer.zone01_05
- alias: Timer 5 Minutes Zone 02
# Timer is started when the switch pumprun is set to on.
trigger:
platform: state
entity_id: switch.01_pro_switch_2
to: 'on'
action:
service: timer.start
entity_id: timer.zone02_05
- alias: Timer 5 Minutes Zone 03
# Timer is started when the switch pumprun is set to on.
trigger:
platform: state
entity_id: switch.01_pro_switch_3
to: 'on'
action:
service: timer.start
entity_id: timer.zone03_05
################ 10 Minutes ########################
- alias: Timer 10 Minutes Zone 01
# Timer is started when the switch pumprun is set to on.
trigger:
platform: state
entity_id: switch.01_pro_switch_1
to: 'on'
action:
service: timer.start
entity_id: timer.zone01_10
- alias: Timer 10 Minutes Zone 02
# Timer is started when the switch pumprun is set to on.
trigger:
platform: state
entity_id: switch.01_pro_switch_2
to: 'on'
action:
service: timer.start
entity_id: timer.zone02_10
- alias: Timer 10 Minutes Zone 03
# Timer is started when the switch pumprun is set to on.
trigger:
platform: state
entity_id: switch.01_pro_switch_3
to: 'on'
action:
service: timer.start
entity_id: timer.zone03_10
Sorry to ask one more favor, but I have tasmota scheduling my on off just in case I loose conectivity to HA.
So this is simply if I want to test them or have them go on for a few if it’s going to be hot and such.
The problem with this setup is if I don’t forget to turn off the button that activates the correct timer it stays on and HA takes over Tasmota on the scheduled timed events.
Is there a way for after the automation button I select (Say the 1 min) turns off at the time of the finished state of the timer. I tried this, but it made an error in my config file. I rebooted and the same happened.
This was a seperate set of automation rules. I tried adding another service to the OFF automation, but it gave an error as well.