When a door is left open for 5 minutes, I have a trigger which is set to look at the door state. Once triggered, media player tells me I left a door open. But it only happens once. How can I get the routine to keep “nagging” me the door is open? I’m using automations UI which might leave out that option?
use the “repeat-until” option.
or use the “alert” integration which is designed specifically for that situation.
Seems like choosing “parallel” also works?
No that won’t work because the trigger for an automation only fires when the trigger changes from false to true.
in your case the trigger never goes back to false (because the door never closes) so the new “parallel” automation sequence will never be triggered.
You have tested and confirmed it?
Or are you just speculating?
I had left the “repeat-until” on by accident. Parallel doesn’t work.
However I now can’t get the alert to stop. The action is triggered, and repeats while the entity ID that was triggered is “true”. But apparently, after I shut the door, it remains “true” and won’t stop alarming.
Post your automation.
I’m using entity IDs because I have lots of doors/windows and use “choose” to customize the alarm to that door or window. Another solution is to re-run the automation after the alert is spoken?
alias: Test automation
description: ""
trigger:
- platform: state
entity_id:
- sensor.den_slider
- light.kitch_slider1
- sensor.front_door
to: Violated
for:
hours: 0
minutes: 0
seconds: 3
id: First Floor Door
alias: When Main Floor is violated
- platform: state
entity_id:
- sensor.ct_1st_slidng_dr
- sensor.ct_east_front_dr
- sensor.ct_guest_br_dr
- sensor.ct_master_br_dr
to: Violated
for:
hours: 0
minutes: 5
seconds: 0
id: Cottage Doors
alias: Cottage Door Open
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: First Floor Door
sequence:
- repeat:
while:
- condition: trigger
id: First Floor Door
sequence:
- service: media_player.play_media
target:
entity_id: media_player.big_inside
data:
media_content_id: >-
media-source://tts/google_translate?message=Repeat+while+triggered
media_content_type: provider
metadata:
title: Repeat while triggered
thumbnail: >-
https://brands.home-assistant.io/_/google_translate/logo.png
media_class: app
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://tts
- media_content_type: provider
media_content_id: >-
media-source://tts/google_translate?message=Repeat+while+triggered
- delay:
hours: 0
minutes: 5
seconds: 5
milliseconds: 0
mode: single
I think I have to reset the entity ID which became “true” to “false” somehow. But I don’t think you can modify an entity ID state?
Better yet would be to execute an alert, exit the automation and have the automation re-run itself?
The condition you specified for while
is incorrect. It will never change so that’s why repeat
loops forever. It should be checking if the state of any of the three entities is Violated. BTW, I assume light.kitch_slider1
is a typo and should be sensor.kitch_slider1
.
Is that a partial example? It doesn’t appear to handle the second trigger, only the first one.
Yes thanks for the typo correction.
I have a LOT of different states to check in final automation, so I’m trying to simplify by not having to check the state of all of my entities if they are not violated. Is there a way I can simply have the automation re-execute?
Yes it’s a partial. Just to test ability to repeat. The full automation is very long.
You need to fix the while
condition first. Allowing for multiple concurrent instances of the automation isn’t the solution.
Right, I want to delete the while, run an alert, and allow the automation to re-run. But it won’t. I get one alert, and that’s all.
Post it.
There’s nothing more frustrating than helping someone fix a partial example only to discover the full example renders the fix inefficient or useless.
That’s the whole original automation. I’d like it to trigger the alert, wait a minute, and re-test the trigger.
It’s really similar to having a light turn on for motion and re-testing, but I’m using an entity ID. Can an automation exit and call itself again?