Opening Garage Door Automation

Hi all,

I have already configured an automation that uses 2 triggers. One for me when entering my home zone and another for the wife when she enters the home zone it will trigger my Shelly 1 to toggle the garage door opener if my garage door is closed (I have a door sensor) and our iPhone activity sensor is automotive. This automation is working fine if we are driving in separate cars and on our own. The part I’m trying to find a solution for is when we are both in 1 car driving home. I don’t want it to trigger both our individual triggers at the same time.

I’ve thought of one condition to add to my wife’s trigger option to block it from executing however it only solves half of the problem. Her conditions will need to be "garage is closed AND her iPhone activity sensor is automotive AND my iPhone activity sensor is NOT automotive. The issue here is that I could be on the road driving when she is coming home which will set my iPhone activity sensor to automotive.

I couldn’t find a thread where someone else had the same issue.

TIA

What’s the issue with that?

If you have the condition that the door is closed before it toggles then shouldnt the second toggle be blocked anyway?

I think you need to make sure to set this up as a single automation and making sure it only runs once. If you have this setup as 2 different automations then that is going to be your biggest hurdle. With 1 automation it should be easy enough to have either you or your wife be the entering zone trigger and then condition be door is closed. It should just run once.

Also, if you can provide your automation YAML we might better be able to see where a fix can be made.

Thanks. Please see my YAML below:

alias: Open the garage door when Holly or Michael arrive home
description: >-
  Trigger the garage door shelly when Michael or Holly's iPhone enter the Home
  Zone.
trigger:
  - platform: zone
    entity_id: person.michael_dang
    zone: zone.home
    event: enter
    id: michael_entered_home_zone
  - platform: zone
    entity_id: person.holly_pham
    zone: zone.home
    event: enter
    id: holly_entered_home_zone
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: michael_entered_home_zone
              - condition: state
                entity_id: sensor.michael_dangs_iphone_activity
                state: Automotive
        sequence:
          - service: notify.mobile_app_michael_dangs_iphone
            data:
              title: Michael entered home zone!
              message: Executing the garage door opener.
          - type: toggle
            device_id: c1d9a813e0fc28742ba94cfaa89b744c
            entity_id: switch.garage_door_opener
            domain: switch
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: holly_entered_home_zone
              - condition: state
                entity_id: sensor.hollys_iphone_activity
                state: Automotive
        sequence:
          - type: turn_on
            device_id: c1d9a813e0fc28742ba94cfaa89b744c
            entity_id: switch.garage_door_opener
            domain: switch
    default: []
mode: single

My concern here is that at the split instant where both options trigger at the same time the garage could be in the state closed so it would toggle once to open and then another trigger would then stop it. I couldn’t find a way to set a timer on my wife’s trigger so that it waits 5 seconds before triggering.

So, please in the future use the Code block when posting as it makes it very hard to know if the code is actually correct because it’s not formatted right.

Anyways, I think you need to simplify this without the trigger IDs and all of the choose actions. You should be able to simply have an automation Condition of Garage Door Closed and then also use the OR condition to say if yours or your wife’s phone is in Automotive state. Then your action is simply open the garage door.

Thanks. I think I know what you mean. Let me test this out.

I have automations that I want to run when both me and my wife have left, and when the first one of us comes home.

  • When the last person leaves, turn all the lights off, make sure the doors are locked, close the garage, etc;
  • When the first person comes home, turn some lights on if it’s after sunset, etc.

To control this, I made a group called “groupPresence” and put me and my wife in it. If anyone is home, the state of groupPresence will be “home”. When we are both away, the state of groupPresence is “away”.

I have this in my configuration.yaml:

group:
  group_presence:
    name: Group Presence
    entities:
      - person.scott
      - person.anne

If you both come home at the same time, groupPresence will still only change state from “away” to “home” once, so you won’t double fire your automations.

Been using this for about 6 months and it works flawlessly.

2 Likes

Thanks for the tip! I’ll check it out.

I have added car presence sensors into my garage. This way I can check which car is not in the garage and open the proper gate only. This provides additional layer of security, as If I return home from walk, it does not trigger garage opening, because car is already there. It 100% reliable vs activity sensor, that sometimes provides false results with high conficence.

1 Like

I addition to the above solutions you could also set a condition that the automation hasn’t triggered in the last 60 seconds or whatever you think is needed:

{{ as_timestamp(now()) - as_timestamp(state_attr('automation.your_automation_id', 'last_triggered')) > 60 }}
1 Like

Hi finity - Do I just add this as a template condition?

yes, it’s a condition.

1 Like

So how do you know that the car is in the garage? Do you have some BLE device or an iBeacon in the cars?

Nope. I use Sharp IR distance sensor placed over the parking slot to detect car - either distance is to the floor (~2m) or to the car roof (~50cm). It is powered by DC and as output gives voltage signal, proportional to distance. This output is connected to analog input of Fibaro Smart Implant. Meaured voltage is passed to template sensor that converst it 0/1 depending on this voltage.

1 Like

HI,

Just adding that I’m using an VL53L0X Time Of Flight Distance Sensor — ESPHome range sensor mounted over the car to detect if the car is in the garage.

Best,

-Philip