Frist, if this is a repeat I apologize up front… Been super busy and finally had a change to get around to this.
Just had the chance to look into a broken automation rule but still not understanding how to resolve. Use to work perfectly, but after .113 update automation rule has been broken. Any help would be appreciated.
In a nut shell:
Rule is set to check if the garage door is left opened when everyone has left the house. If the garage is left opened it will send a reminder notification every 10 minutes until the garage door is closed.
Have discovered, when coming home and opening the garage door before HA knows we are home, it will send a notification. Then HA recognizes we are home but the timer continues to repeat sending notification every 10 minutes until the garage door is closed.
id: '1588618949530'
alias: Garage Door Left Opened (Leaving House)
description: ''
trigger:
- entity_id: group.track_all_persons
from: home
platform: state
to: not_home
- event_data:
entity_data: timer.garage_door
event_type: timer.finished
platform: event
condition:
- condition: state
entity_id: binary_sensor.visonic_mct_340_e_xxxxxxxxx_1_1280
state: 'on'
action:
- data:
data:
priority: high
ttl: 0
message: Garage door still opened. Turn around and close.
service: notify.mobile_app_sm_n950u
- data:
data:
priority: high
ttl: 0
message: Garage door still opened. Turn around and close.
service: notify.mobile_app_sm_g973u
- data: {}
entity_id: timer.garage_door
service: timer.start
You also have the option of using the new repeat functionality introduced in 0.113.
The following sends notifications, pauses for 10 minutes, then repeats but only if the binary_sensor is on.
id: '1588618949530'
alias: Garage Door Left Opened (Leaving House)
description: ''
trigger:
- entity_id: group.track_all_persons
from: home
platform: state
to: not_home
condition:
- condition: state
entity_id: binary_sensor.visonic_mct_340_e_xxxxxxxxx_1_1280
state: 'on'
action:
repeat:
while:
- condition: state
entity_id: binary_sensor.visonic_mct_340_e_xxxxxxxxx_1_1280
state: 'on'
sequence:
- data:
data:
priority: high
ttl: 0
message: Garage door still opened. Turn around and close.
service: notify.mobile_app_sm_n950u
- data:
data:
priority: high
ttl: 0
message: Garage door still opened. Turn around and close.
service: notify.mobile_app_sm_g973u
- delay:
minutes: 10
EDIT
You can probably remove the initial condition and it would still work correctly because the condition within the repeat will ensure that notifications are sent only if the binary_sensor is on.
hey, great example. helping me with something like this.
Was wonderig if I couldn’t leave out the main condition completely? Since it wont do anything is the condition is off in the repeat block either?
EDIT
Haha, no such thing as coincidence thanks for the edit! will give it a go!
Ha! Just after I finished amending my post, I saw yours. Yes, I do believe the initial condition can be removed.
id: '1588618949530'
alias: Garage Door Left Opened (Leaving House)
description: ''
trigger:
- entity_id: group.track_all_persons
from: home
platform: state
to: not_home
action:
repeat:
while:
- condition: state
entity_id: binary_sensor.visonic_mct_340_e_xxxxxxxxx_1_1280
state: 'on'
sequence:
- data:
data:
priority: high
ttl: 0
message: Garage door still opened. Turn around and close.
service: notify.mobile_app_sm_n950u
- data:
data:
priority: high
ttl: 0
message: Garage door still opened. Turn around and close.
service: notify.mobile_app_sm_g973u
- delay:
minutes: 10
EDIT
I think what would not work correctly is if it used repeat - until. It would send the notifications once and then check the condition. repeat - while checks the condition first and then determines if the sequence should be executed.
Taras, since you’re online, please let me ask you to have a look at an earlier post of mine, where I seek to optimize an automation… no hurry, it works, but I have a feeling this can be optimized… thanks if you would.