Automation: repeat until (please help)

Hi everybody,

I am trying to write an automation to inform us via telegram every x minutes if a certain input_boolean is off until it has been turned on. To test this, I wrote the automation below, which does not work.

alias: Test Automation wiederholen
description: ''
  - platform: time
    at: '12:22:00'
condition: []
  - repeat:
        - condition: state
          entity_id: light.arbeitszimmer_licht_gruen
          state: 'off'
        - service: notify.tg_ben
            message: Grün ist an
        - delay:
            hours: 0
            minutes: 0
            seconds: 20
            milliseconds: 0
mode: single

This was supposed to fire at 12:22. I saved the automation before this time (and, in fact, tried multiple times with different at values to make sure the time Home Assistant uses wasn’t just off a few seconds).

The light entity in question is currently on. I expected to get Grün ist an every 20 seconds until that light had been turned off. But instead, nothing happened.

What did I do wrong?

Thank you in advance for your help :slight_smile:

Are you aware of the alert integration?


Thank you! I remember testing this ages ago, but totally forgot that it existed! That is even better.

Below is my new approach. However, when testing, I did this

  • create the alert
  • input_boolean.helper_medusa_oben: off
  • restarted home assistant
  • deactivated the alert (because I want to activate it at a specific time so that it will only work at certain times)
  • re-activated the alert ===> nothing happens
  • turn the input_boolean on
  • then turned the input_boolean off ===> then I got the alert

However, I’d like the alert to trigger as soon as the alert is turned on and the condition (input_boolean.helper_medusa_oben is off) is met.

    name: "Medusa oben"
    icon: "mdi:robot-vacuum-variant"

    name: "Vacuum Medusa Oben"
    entity_id: input_boolean.helper_medusa_oben
    state: "off"
    repeat: 10
    can_acknowledge: true
    skip_first: false
      - tg_ben
    message: "Bitte Medusa nach oben holen!"
    done_message: "Vielen Dank."

  - alias: "Notify Helper Vacuum Off"
      - platform: time
        at: "00:00:00" # ==> this is because the device is downstairs during the day
      - service: input_boolean.turn_off
        entity_id: input_boolean.helper_medusa_oben
  - alias: "Notify Helper Medusa On"
      - platform: time
        at: "20:15:00"
      - service: alert.turn_on
        entity_id: alert.medusa_oben

So this should all work, except that the alert doesn’t seem to work when the state is already off when it is activated. Other than that, this is amazing! Especially the callback.

Why don’t you turn off the input boolean at 20:15 then and keep the alarm turned on?

I’ll try that. Thing is, I was hoping that people would eventually remember to bring the device upstairs on their own (without the alert), so they could use a wall switch to turn that boolean on. If so, turning it off at 20:15 would still trigger the alert even in those cases where the device had already been brought up.

But I changed things to this for now and will see how that goes :slight_smile: