Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 110876

Automation: (Loops) How to repeat an action 4 times ..with 90 second intervals

$
0
0

I have an automation (below) which will make an announcement/notification to my Alexa Echo Dot and Google Nest Mini when the back door is open longer than 7 minutes.

How can I make the automation repeat the announcement 4 times with 90 seconds wait between each announcement?

- 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:
  - data:
      entity_id: media_player.living_room_speaker
      message: Please don't forget to close the back door!
    service: tts.google_translate_say
  - data:
      target: 
        - media_player.mka_net_echo_dot
      data:
        type: announce
      message: "Please don't forget to close the back door!"
    service: notify.alexa_media
  mode: single

Below, is my best attempt at doing this. I’m hoping someone can check my syntax to see if I’m doing this correctly or not (or if there’s a better way to do this):

- 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:
    service: loop.loop
    data:
      loops: 4
      delay_after: 90
      actions:
        - data:
            entity_id: media_player.living_room_speaker
            message: Please don't forget to close the back door!
          service: tts.google_translate_say
        - data:
            target: 
              - media_player.mka_net_echo_dot
            data:
              type: announce
            message: "Please don't forget to close the back door!"
          service: notify.alexa_media
        mode: single

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 110876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>