Continuous alerts setup

I have set up a float switch on a shelly1 to send an alert when my sump water tank gets to a certain level. And that works. What I’m trying to do know is set up an automation to send an alert every 5 minutes as long as the switch is closed. I can’t seem to get that to work. Below are both the automations. Does anyone see what I’m doing wrong? Thanks in advance.

- id: '1688153474115'
  alias: Sump Pump water level warning
  description: ''
  trigger:
  - platform: state
    entity_id:
    - cover.sump_pump_level_switch
    from: open
    to: closed
  condition: []
  action:
  - service: notify.mobile_app_idevice_iphone
    data:
      message: Sump Pump water level warning
  - service: notify.mobile_app_idevice_ipad
    data:
      message: Sump Pump water level warning
  mode: single
- id: '1688398597411'
  alias: Sump Pump continuous alerts
  description: ''
  trigger:
  - platform: state
    entity_id:
    - cover.sump_pump_level_switch
    to: closed
  condition: []
  action:
  - repeat:
      while:
      - condition: state
        entity_id: cover.sump_pump_level_switch
        state: closed
        for:
          hours: 0
          minutes: 5
          seconds: 0
      sequence:
      - service: notify.mobile_app_idevice_ipad
        data:
          message: Sump Pump level still critical
      - service: notify.mobile_app_idevice_iphone
        data:
          message: Sump Pump level still critical
      - delay:
          hours: 0
          minutes: 5
          seconds: 0
          milliseconds: 0
  mode: single

Use the alert integration instead of trying to automate it. This is exactly the situation it is for:

2 Likes