Automation to notify when Garage is left open & no one home

I have a ratgdo on my garage door. I want an automation to notify me when neither me nor my spouse is open and the garage is open.

I created the below but this only works if neither of us are home and the garage goes from closed to open, NOT if its already open and then we leave.

I think I need the trigger to just go off the garage door’s status but I can’t seem to find how to do that.

Any suggestions on what to change?

alias: "Notification: Garage Open; No One Home"
description: >-
  Notify when the garage door has been open for more than 10 minutes and
  no one is home.
trigger:
  - platform: state
    entity_id:
      - cover.garage_door
    to: open
    for:
      hours: 0
      minutes: 2
      seconds: 0
condition:
  - condition: not
    conditions:
      - condition: zone
        entity_id: person.tom
        zone: zone.home
      - condition: zone
        entity_id: person.kiley
        zone: zone.home
action:
  - data:
      message: The garage door is open and you/Kiley aren't home.
      title: "ALERT: Garage Open, No One Home"
    action: notify.mobile_app_tom_s_iphone
  - action: notify.mobile_app_kileys_iphone_2
    metadata: {}
    data:
      message: The garage door is open and you/Tom aren't home.
      title: "ALERT: Garage Open, No One Home"

Hi templeowls,

That trigger will only happen after it switches from some state to ‘open’ stays in that state until the for: time. I would assume that you are likely ‘home’ when the door opens, so that condition will not allow execution. This will only work if no one is home when the door is opened.

Looks like the same issue here Automation not for airco triggering - #2 by Didgeridrew

Reversing the trigger and condition would solve your issue :wink:

Instead of triggering on the door’s state, trigger on each person leaving the home zone.

trigger:
  - platform: state
    entity_id:
      - person.tom
      - person.kiley
    not_to:
      - 'home'
      - 'unknown' ## <--- You may need to remove this state
    for:
      minutes: 2
condition:
  - condition: not
    conditions:
      - condition: zone
        entity_id: person.tom
        zone: zone.home
      - condition: zone
        entity_id: person.kiley
        zone: zone.home
  - condition: state
    entity_id: cover.garage_door
    state: open
action:
  ... etc ...
1 Like

I gave this a try but no luck. I’m assuming because the trigger is still based on it changing from “something” to “open”. Rather than just solely being based on the status of “open”

But what if my spouse is in a designated zone (i.e. “work”), and then I leave the home and leave the door open. Wouldn’t this not trigger since we both aren’t in an “unknown” zone?

The State Trigger’s option is not_to.

It triggers when the person’s new zone is anything other than home or unknown. The goal is to detect when the person entity leaves the home zone.

It may be possible that unknown should be included (and not excluded as I have suggested with not_to). I can’t tell for sure because I don’t have the means to experiment with a person entity changing zones. Minimally, it needs to detect the person leaving the home zone (i.e. it’s new state is not home).

Have a look at Proximity
image
(f.e. my Alarm arms on when all persons distance > 200 meter, and disarm again when distance below 200 meter)

Gotcha, I’ll give this a test when I leave home next. Thanks!

Pay attention to the person entity’s state when they leave home. If I remember correctly, it should change from home to not_home. That should satisfy the State Trigger I suggested.

Another way to configure the State Trigger would be to detect a specific change from one state to another like this:

  - platform: state
    entity_id:
      - person.tom
      - person.kiley
    from: home
    to: not_home
    for:
      minutes: 2