Repeat Until automation ,service is an invalid option for automation

I am trying to create an automation that will alert me via push bullet and tts when any door is open. This is determined by checking the state of 5 doors. If the sensor is set to on the automation should trigger and repeat itself until the door(s) are closed.

I am getting this error:
Invalid config for [automation]: [service] is an invalid option for [automation].

I see I could use an Alert but I am curious why the automation won’t work . Thanks for any help you can offer.

# Keep NotifyingUntilFrontDoor is off
- id: CriticalSensorOn  
  alias: 'CriticalSensorAlert'
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: 
    - binary_sensor.door_one
    - binary_sensor.door_two
    - binary_sensor.door_three
    - binary_sensor.door_four
    - binary_sensor.door_five
    to: 'on'
  action:
    - service: persistent_notification.create
      data_template:
        message: The {{ trigger.to_state.attributes.friendly_name }} was left open
        title: 'Warning'           
      repeat:
        sequence:
          - service: homeassistant.turn_on 
            data:
              entity_id: 'light.gateway_light_7811dcfd69df'         
              color_name: 'red'
              brightness: '255'
          - delay: '00:00:01'
          - service: notify.pushbullet
            data_template:
              title: Door Left Open
              message: The {{ trigger.to_state.attributes.friendly_name }} was left open               
          - delay: '00:00:01'
          - service: tts.google_say
            data:
              entity_id: media_player.living_room_speaker
              message: The {{ trigger.to_state.attributes.friendly_name }} was left open
          - service: tts.google_say
            data:
              entity_id: media_player.bathroom_speaker
              message: The {{ trigger.to_state.attributes.friendly_name }} was left open
          - service: tts.google_say
            data:
              entity_id: media_player.dinning_room_speaker
              message: The {{ trigger.to_state.attributes.friendly_name }} was left open
          - service: xiaomi_aqara.play_ringtone
            data:
              gw_mac: 7811DCFD69DF
              ringtone_id: 10001
              ringtone_vol: 100 
        until:
          - condition: state      
            entity_id: 
            - binary_sensor.door_one
            - binary_sensor.door_two
            - binary_sensor.door_three
            - binary_sensor.door_four
            - binary_sensor.door_five
            state: 'off'       
 
``````````````````````````````````````````````````````

Add a hyphen in front of repeat like so:

    - repeat

Without it, it appears to be a continuation of the previous action (the service call).

Thanks so much. I was chasing my tail. I learned what the hyphens means too.
Thanks again.

You appear to have misunderstood the purpose of the Solution tag. You have marked your own post as the Solution yet it contains no information explaining how to resolve the problem.

The purpose of the Solution post is to help you and others resolve the original problem. It is the custom of this community forum to mark the first, or most complete, post that explains the cause of the problem and how to correct it (if a correction exists). When others with a similar question read the Solution post, they should be able to learn how to fix the problem. Please consider marking my post (above) with the Solution tag.

Thanks. I fixed it now. I appreciate you explaining.

1 Like