Repeat Announcement Until Trash Is Taken Out

I recently switched to HA from Hubitat and I can’t seem to figure out how to create this automation in HA.

What the automation should do:

Trigger at 6 in the morning only on Tuesday and Friday.
Alexa to announce that it’s trash day every 10 minutes until either the front door or one of the garage doors are opened.
Stop the repetition and send a message to my phone that the trash was taken out.

This is what I have so far:

alias: Announcement Trash Day
description: ""
trigger:
  - platform: time
    at: "06:00:00"
condition:
  - condition: time
    weekday:
      - tue
      - fri
action:
  - repeat:
      until:
        - condition: or
          conditions:
            - condition: state
              entity_id: binary_sensor.front_door_contact_sensor_window_door_is_open
              state: "off"
            - condition: state
              entity_id: binary_sensor.norbi_garage_door_tilt_sensor_window_door_is_open
              state: "off"
            - condition: state
              entity_id: binary_sensor.sonia_garage_door_tilt_sensor_window_door_is_open
              state: "off"
      sequence:
        - service: notify.alexa_media_living_room_echo_dot_5th_gen
          data:
            message: Today is trash day, please take out the trash.
        - service: notify.mobile_app_norbi_note_20_ultra
          data:
            message: Today is trash day, please take out the trash.
            title: Trash Day Reminder
        - delay:
            hours: 0
            minutes: 10
            seconds: 0
            milliseconds: 0
  - service: notify.mobile_app_norbi_note_20_ultra
    data:
      message: The trash was taken out.
mode: single

I think the problem is the 10 minute delay. If I understand correctly it checks the conditions every 10 minutes. I would need something that keeps the repetition going but stops as soon as one of the 3 doors changes to open.

Any ideas how to go about this in HA?

Use the built-in Alerts Integration for repeating notifications.

1 Like

My wife would divorce me if I created an automation like this

1 Like

For me, instead of “Repeat Until” I just use the time condition to run every ten minutes “/10”. You roll that into your conditions and you should be OK.

I have a similar automation for my trash pickup (although not as annoying as every 10 minutes LOL) and I use helpers to indicate if it has been done or not, which drives the repeats. Then a second one, for you, would be to toggle that helper when one of your motion sensors trip.

Or get super fancy and put a pressure pad under your garbage can so you know if it’s been taken to the street. While it’s overkill, that’s what we do in home automation is over-automate to the point of being silly but it’s fun!

Thank you, I will look into this.

alias: Announcement Trash Day
description: ""
trigger:
  - platform: time
    at: "06:00:00"
condition:
  - condition: time
    weekday:
      - tue
      - fri
action:
  - repeat:
      until:
        - condition: or
          conditions:
            - condition: state
              entity_id: binary_sensor.front_door_contact_sensor_window_door_is_open
              state: "off"
            - condition: state
              entity_id: binary_sensor.norbi_garage_door_tilt_sensor_window_door_is_open
              state: "off"
            - condition: state
              entity_id: binary_sensor.sonia_garage_door_tilt_sensor_window_door_is_open
              state: "off"
      sequence:
        - service: notify.alexa_media_living_room_echo_dot_5th_gen
          data:
            message: Today is trash day, please take out the trash.
        - service: notify.mobile_app_norbi_note_20_ultra
          data:
            message: Today is trash day, please take out the trash.
            title: Trash Day Reminder
        - repeat:
            until:
              - condition: or
                conditions:
                  - condition: template
                    value_template: "{{ repeat.index >= 120 }}"
                  - condition: state
                    entity_id: binary_sensor.front_door_contact_sensor_window_door_is_open
                    state: "off"
                  - condition: state
                    entity_id: binary_sensor.norbi_garage_door_tilt_sensor_window_door_is_open
                    state: "off"
                  - condition: state
                    entity_id: binary_sensor.sonia_garage_door_tilt_sensor_window_door_is_open
                    state: "off"
            sequence:
              - delay:
                  seconds: 5
  - service: notify.mobile_app_norbi_note_20_ultra
    data:
      message: The trash was taken out.
mode: single
1 Like

I use a bluetooth tracker on my trash container and ESPresense to ensure it was both taken to the street and recovered back to the house after trash day. Works like a champ.