Ability to Detect (or Ignore) When a Person Transitions from One Zone to Another Zone

Current Scenario: I have an automation script that detects when either myself or my wife’s phone (iPhone 14s) enters the ‘home’ zone, and plays a “name is arriving home” message over the Sonos speakers throughout the house. (The actual name is based on whose phone and whether the other person is in the house - no point playing the message to an empty house.) However, to detect their impending arrival home in a timely manner, I’ve had to extend my default Home zone to encompass the whole subdivision so I can play the message long before they’re parking the car! Obviously, this renders my home zone useless for actually indicating somebody is in the house. I can live with this if I have to.

Ideal Solution: I’d like to shrink the Home zone to cover just the house and grounds (and then I can use it to detect whether somebody, or more precisely their phone, is actually in the house), and then create a larger overlapping zone that covers the whole subdivision, which obviously will include the house. I assume the person location sequences when I come home would be ‘away’ → ‘Subdivision’ → ‘Home’, and when I leave it would be ‘Home’ → ‘Subdivision’ → ‘away’.

I only want my automation to trigger when I transit on the ‘away’ → ‘Subdivision’ boundary (which I can do), but NOT on the ‘Home’ → ‘Subdivision’ boundary (which also occurs).

Questions:

  1. Is it possible for zone detection to conditionally occur when transiting from a named zone to another named zone (i.e. from ‘away’ to Subdivision’, but not from 'Home ’ to ‘Subdivision’)?

  2. If not, then Plan-B would be for a reliable person-in-the-house presence detection approach so I know whether somebody (or their phone) is actually in the house or not. (I’ve tried checking whether either phone is connected to the local Wifi, but that is unreliable as it gets confused when the phone goes to sleep overnight, or the HA companion app does not keep up to date, which also occurs when the phone is idle for a while.) My WiFi is based on a Google Mesh system.

Any ideas would be greatly appreciated.

Yes, there are multiple ways to do this such as adding a to and from to your trigger or using template conditions to check the to_state and from_state values. However, overlapping zones can sometimes cause issues. Instead, you may want to take a look at the Proximity integration.

As to Plan-B, reliable general presence detection often requires multiple modalities. If your router has a HA integration that will create device trackers use it. If your server has bluetooth capabilities or you have an ESP32 you can use as a Bluetooth proxy use that to track your phones as well.

Thanks, Drew.

So if I read this right, Proximity integration would allow me to create a small zone (Home) over my house, yet it could be used to trigger automation if a phone (or phones) came within so many yards of the zone - in my case, 1/4 mile as people enter the subdivision (and I can also tell if the phone is coming or going, which is not really important for my scenario). Yes? If so, that would certainly solve my issue.

Sadly, my Google WiFi router (AFAIK) doesn’t support either Bluetooth or has a HA integration that can be used. (No idea what ESP32 is, but I’m guessing it doesn’t have that either.) It’s a generic Google puck; actually, a collection of four Google pucks.

Yes

The Bluetooth would be on whatever computer you are running Home Assistant on, not the router.

An ESP32 is a small WiFi and Bluetooth-enabled microprocessor board used in many off-the-shelf smart home devices and for DIY projects. Home Assistant’s sister application ESPHome can be used to turn $5-10 development boards into Bluetooth Proxies that will listen for the Bluetooth advertisement signals given off by your phones. These can be very helpful for getting reliable general presence detection.

Perfect. I created a quick automation to detect whether I’m a mile from the ‘home’ zone and if less (i.e. at home), then toggle a binary helper to ON, otherwise, trigger it to OFF (away). When it stops snowing, I’ll take my phone out for a test drive to see if it works as hoped.

I’m running HA Yellow, so presumably that has built-in Bluetooth. We have a fairly large house, so I’m not sure if a phone upstairs in the kitchen with BT connect to the Yellow in the downstairs office. (I know my Tesla sometimes has issues depending where in the house the phone currently is.) The question is, even if HA Yellow ‘saw’ my iPhone’s BT broadcast, how would that translate in practice to it being recognized in an automation script? (I’ve never played with HA-Y’s Bluetooth to know how it detects nearby devices.)

I don’t think the Yellow board itself has built-in bluetooth… it might depend on which RPi 4 Compute module is installed, there are a bunch of variants, some with and some without.

The Bluetooth integration will create a device tracker entity of it’s own for each device it “sees” then you just add that to your person entity.

Got it. Thanks.