@finity I feel really bad for pulling you into this message. You’ve gone completely out of your way to help me. Please don’t feel obligated to help me. I don’t wantto take advantage of your kindness.
Having said that… and, taking a couple of steps back… Is there a reason why I can’t just stick to the original plan to use a single automation… using the repeat feature… then, use the until condition to stop it from repeating. If I understood right, the only reason we dumped the idea of using the repeat feature is because it would continue to repeat even if the condition isn’t true anymore.
we never dumped the repeat feature. You never said you wanted to use that method. You can use whichever method fits your needs and skill set.
And no I don’t mind helping at all and don’t feel obligated in any way. You’re just some “stranger on the internet” so If I wanted to walk away I could do so any time.
At least your trying to work thru things and figure it out.
The people I really don’t like to help are the ones that don’t even try. And what’s worse are the ones who keep coming back over and over basically expecting you to write the code for them because they don’t want to put the effort in to learn. There’s been a few of those over the years.
Oh, and you don’t have to put the @username symbol in the post. Just hit the reply button in my post and it will notify me too.
Thanks. I was just trying to say is when you had mentioned that if I use the repeat feature, “…Realize tho that once this triggers and starts the count the actions will continue to run for 4 repeats even if the door gets closed in the meantime.”
That’s what turned me off from using that method; looking for a way that doesn’t have that limitation.
I had missed Tom_I’s comment that “That’s where you would use “repeat until”. e.g. repeat until the door is closed.” until noticed it just a little while ago.
Anyway, I added the until condition to the script below. I’m not sure if it’s right… I haven’t had a chance to test it; but, I’m hoping it does what I think it does…
- id: '1597611826726'
alias: Back Door open warning
trigger:
- entity_id: binary_sensor.ecolink_door_window_sensor_sensor_2
for: 00:07:00
from: 'off'
platform: state
to: 'on'
action:
- repeat:
count: '4'
sequence:
- data:
entity_id: media_player.living_room_speaker
message: Please don't forget to close the back door!
service: tts.google_translate_say
- data:
data:
type: announce
message: Please don't forget to close the back door!
target:
- media_player.mka_net_echo_dot
service: notify.alexa_media
- data:
message: Please don't forget to close the back door!
service: notify.sms_family
- delay: 00:01:30
until:
- condition: state
entity_id: binary_sensor.ecolink_door_window_sensor_sensor_2
state: 'off'
mode: single
The new automation functions are very new and I haven’t used them enough to be confident in them yet.
But looking at the docs I’m not sure that the “count:” option is available in the until structure. So you may be in a similar boat as you were before with it continuing to run until the door is closed instead of it running only 4 times.
But try it and see. It may just not be documented.
finity, using repeat… until works great (after removing count). This is been a great learning experience. I appreciate your guidance. I still plan on getting my alexa/google notifiers setup later in case I ever need to use HA alerts.
Hi there,
I had a similar automation that neatly emitted a notification if the door was open that I wanted to adjust so that this notification is repeated if the door is left open.
Now that I’ve added ‘repeat until’, however, I get an error
type oInvalid config for [automation]: expected dict for dictionary value @ data['action'][1]['repeat']['sequence'][0]['data']. Got None extra keys not allowed @ data['action'][1]['repeat']['sequence'][0]['message']. Got None extra keys not allowed @ data['action'][1]['until']. Got None. (See ?, line ?).r paste code here
Here’s my automation file (entities\automations\kitchen\open_door.yaml :
alias: 'deur_open'
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.sonoff_keuken_deur_01
from: 'off'
to: 'on'
for: '00:00:30'
condition:
- condition: state
entity_id: binary_sensor.sonoff_keuken_deur_01
state: 'off'
mode: single
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.keuken
volume_level: 0.8
- alias: herhaal bericht totdat de deur gesloten is
- repeat:
# count: '4'
sequence:
- service: tts.google_say
data:
entity_id: media_player.keuken
message: 'Hallo! Graag de deur dicht doen, anders wordt de verwarming uitgeschakeld'
- delay: '00:00:10'
until:
- condition: state
entity_id: binary_sensor.sonoff_keuken_deur_01
state: off
Hi @Plaatjesdraaier . I wish I knew how to help you with the error you’re getting. Does that error only happen after you add “repeat until”? Your code looks very similar to mine. This probably requires someone with a deeper knowledge of Home Assistant than me such as @finity
I’m very bad with yaml. However, I’ve found out that Home Assistant is extremely picky sometimes (for no apparent reason) when it comes to which items are chosen to be preceded by a hyphen in yaml code.
The main difference I see between the code I’m using (below) and the one you’re using is in the sequence… you’re adding a hyphen to - service instead of - data. Try making your code as close to mine as possible by taking off the hyphens from service… and adding hyphens to data instead. Maybe, that’s all that you need to do?
- id: '1598025836523'
alias: 'Back Door open warning: Alexa/Google'
description: Alexa/Google voice message after back door has been open for more than
7 minutes
trigger:
- entity_id: binary_sensor.ecolink_door_window_sensor_sensor_2
for: 00:07:00
from: 'off'
platform: state
to: 'on'
action:
- repeat:
sequence:
- data:
volume_level: 0.7
service: media_player.volume_set
entity_id: media_player.living_room_speaker
- data:
entity_id: media_player.living_room_speaker
message: Please remember to close the back door!
service: tts.google_translate_say
- data:
volume_level: '0.8'
service: media_player.volume_set
entity_id: media_player.kookoo_s_echo_flex
- data:
data:
type: announce
message: Please remember to close the back door!
target:
- media_player.mka_net_echo_dot
- media_player.kookoo_s_echo_flex
service: notify.alexa_media
- delay: 00:02:00
until:
- condition: state
entity_id: binary_sensor.ecolink_door_window_sensor_sensor_2
state: 'off'
mode: single
Invalid config for [automation]: extra keys not allowed @ data['action'][0]['repeat']['until'][0]['mode']. Got None must contain at least one of service, service_template. @ data['action'][0]['repeat']['sequence'][0]. Got None must contain at least one of service, service_template. @ data['action'][0]['repeat']['sequence'][1]. Got None. (See ?, line ?).