#Best way to build a progressive automation (chicken coup door left open)

1 messages · Page 1 of 1 (latest)

ancient wagon
#

I'm trying to think how to build an automation that will progressively take additional, more obnoxious actions if a condition isn't resolved. It's out chicken coup door - around sunset, if it's open I want to sent notifications to phones. If 15 minutes later it's still open, I want to flash some kitchen lights. 30 minutes more and I may do something even more obnoxious.

Is this best accomplished with a single automation and 3 conditional actions? Or is this a 3 automation scenario?
I want to use this same approach for other things (garage door, etc.) so would like to knwo the best practice or reccomended way to build it.

obtuse temple
#

3 automations would be most straightforward, but 1 with multiple triggers and a choose is also okay

#

Each trigger is a state trigger with an increasingly long 'for:' value

ancient wagon
#

I hadn't thought of using state duration, I didn't know HA tracked that. Thanks for the tip. I'm assuming that once the door is closed and the contact switch closes that the state resets.

ancient wagon
#

I realized my real use case is where my son opens the coup door in the morning to air the coup out which is fine, but then as the sun sets the door is still open. So this is more of a schedule or "sun" trigger I think.
What I think I'd like is:

  1. Automation triggers based on sun setting
  2. Every hour it's open I execute another action to try and get our attention

I need to sort out how to test sun based automations without wait a day for the sun to set!
Here's the YAML

description: ""
triggers:
  - trigger: sun
    event: sunset
    offset: "-01:00:00"
    id: "-1 hour to sunset"
  - trigger: sun
    event: sunset
    offset: 0
    id: sunset
  - trigger: sun
    event: sunset
    offset: "1:00:00"
    id: 1 hour after sunset
conditions:
  - condition: state
    entity_id: binary_sensor.chicken_coup_backdoor_intrusion
    state: "on"
    for:
      hours: 0
      minutes: 5
      seconds: 0
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - "-1 hour to sunset"
        sequence:
          - action: notify.mobile_app_sugar3
            metadata: {}
            data:
              message: coup back door open
        alias: door open - warning 1
      - conditions:
          - condition: trigger
            id:
              - sunset
        sequence:
          - action: notify.mobile_app_sugar3
            metadata: {}
            data:
              message: coupe stage 2 open
        alias: door open - warning 2
      - conditions:
          - condition: trigger
            id:
              - 1 hour after sunset
        sequence:
          - action: notify.mobile_app_sugar3
            metadata: {}
            data:
              message: Chickens gonna die!!!!
        alias: door open - chicken death imminent
mode: single```
opaque pelican
#

Yeah, you don't want to trigger on the door state, that's unrelated to when you want to close it. That's only related to sunset. And you can just make multiple triggers with different offsets for the different notifications.

The state of the door is only a conditions.

[edit]Missed the yaml but that seems spot on 🙂 I would only now remove the for on the door state.