I’ve created an automation from scouring the forum and Reddit. The automation should do the following:
If Pixel 8 Pro Leaves the Home Area
and
Pixel 8 Pro is connected to either car1 bluetooth or car2 bluetooth
Perform garage door close
then
notify phone apps about entering or leaving
I have this setup for my wife’s phone too and then the same for when we Arrive home. However, I was walking away from my house and the garage door started to close. As I was walking down the street (away from the house), the door decided to open again. What’s strange is that my wife wasn’t near the house, and my phone wasn’t connected to either bluetooth device and my wife’s phone wasn’t connected to either device nor was she entering/leaving home. From what I understand, this automation will only fire when entering/leaving the home area and when one of the phones is connected to bluetooth. Can someone tell me what I’m doing wrong? I had thought that maybe I should duplicate/separate the automation (one for my phone, one for wife’s), but it should only fire when enter/leaving the home area so one of us would be near/leaving the house. Thanks!
- id: '1706401525303'
alias: Arriving Home or Leaving Home
description: ''
trigger:
- platform: zone
entity_id:
- device_tracker.pixel_7_pro
- device_tracker.pixel_8_pro
zone: zone.home
event: enter
id: PhoneEntersHome
- platform: zone
entity_id:
- device_tracker.pixel_7_pro
- device_tracker.pixel_8_pro
zone: zone.home
event: leave
id: PhoneLeavesHome
condition:
- condition: or
conditions:
- condition: template
value_template: >
{% set c = state_attr('sensor.pixel_8_pro_bluetooth_connection',
'connected_paired_devices') %}
{{ c is not none and c is search('FF:FF:FF:B9:3F:26') }}
- condition: template
value_template: >
{% set c = state_attr('sensor.pixel_8_pro_bluetooth_connection',
'connected_paired_devices') %}
{{ c is not none and c is search('FF:FF:FF:A3:95:61') }}
- condition: template
value_template: >
{% set c = state_attr('sensor.pixel_7_pro_bluetooth_connection',
'connected_paired_devices') %}
{{ c is not none and c is search('FF:FF:FF:B9:3F:26') }}
- condition: template
value_template: >
{% set c = state_attr('sensor.pixel_7_pro_bluetooth_connection',
'connected_paired_devices') %}
{{ c is not none and c is search('FF:FF:FF:A3:95:61') }}
action:
- service: notify.mobile_phones
metadata: {}
data:
message: "{% if trigger.event == \"leave\" %}\n {{ trigger.from_state.attributes.friendly_name
}} left {{ trigger.zone.attributes.friendly_name }}\n{% else %}\n {{ trigger.from_state.attributes.friendly_name
}} entered {{ trigger.zone.attributes.friendly_name }}\n{% endif %}\n"
- choose:
- conditions:
- condition: trigger
id:
- PhoneLeavesHome
sequence:
- device_id: b8ba73e35b47be6483312be1c1144357
domain: cover
entity_id: cc8f9a79dd12bd084c30ef3111289602
type: close
- conditions:
- condition: trigger
id:
- PhoneEntersHome
sequence:
- device_id: b8ba73e35b47be6483312be1c1144357
domain: cover
entity_id: cc8f9a79dd12bd084c30ef3111289602
type: open
mode: single
I don’t see anything obviously wrong with your conditions so I don’t know why that part didn’t block the automation.
But as far the trigger goes did you look at the state of your phone at the time that the door was closing & re-opening? it’s possible that the phone position signal might have been bouncing enough that it was going into and out of the zone as you were walking slow enough to be able allow the zone data to jitter a bit. That would be less likely while driving.
you could always use a state trigger for the phones being in or out of the home zone for several minutes instead of a zone event trigger to mitigate that part.
Thanks for responding! I was dealing with my 7 yr old on a bicycle at the time, so I didn’t get a chance to see what was causing the automation to trigger. However, the way that I’ve written the automation, shouldn’t both conditions be true? Me entering/leaving a zone and a phone being connected to the car’s bluetooth? Regardless of the entering/leaving zone, the fact that both phones weren’t connected to the cars should not have made the automation fire. Did I write the automation correctly?
Is the Bluetooth always on in the cars?
Perhaps you were in range after all? Sometimes the range of Bluetooth can be surprisingly long (but most of the time opposite).
Also the sensor could have been slow to update?
I know my phone can sometimes believe it’s connected to headphones that is turned off for a while
I was in my car when that automation triggered. I stayed home after that. At 7:06:21pm (while eating dinner) my phone sent me a notification about arriving home. That meant that the automation triggered again:
My car and my wife’s car were both not running, so we should not have been connected to bluetooth. We and our phones were both home. My wife uninstalled the HA app on her Pixel 7 Pro a month or more ago and has not re-installed it. However, last night, the automation fired thinking one of our phones left home:
In that screenshot I’m not sure how to determine which phone was showing as away, then home. Then the automation fired again thinking that we were home and that her phone was connected to her car’s bluetooth (the fourth CONDITION being true is the bluetooth MAC of her car):
I don’t know which phone being home/away is the one that caused the automation to fire, but it’s obvious that her phone, that doesn’t have the HA app installed is showing that its connected to her car’s bluetooth. Checking the current STATE of her phone’s bluetooth connection shows that her phone thinks it’s connected to her car and to her watch still. Also, the state showed her phone as AWAY, so I’m guessing that I hit a case where her phone showed AWAY, and paired to her cars BT. Then my phone showed HOME (on another HA OS poll of my device) and that triggered the automation to run again, thus opening the door. I am not including a screenshot as I don’t want to go through the process of blurring/blacking/whiting out the bluetooth MAC addresses. I think that because I wrote a single automation for both phones that it caused this funkiness to happen. I need to write separate automations for our phones (my phone now) so that I’ll know what is firing when. Unless someone has a better idea for a single automation for both/any/all devices.
I went to SETTINGS > INTEGRATIONS > CLICK ON MOBILE APP (not the devices link) and then I saw her phone and clicked three dots and then DELETE. Hopefully that does it. I’ll have to get into my automation and remove references to her phone. Once I’m satisfied that the integration isn’t doing something crazy again, I’ll mark this issue as solved. Thanks for everyone’s help!