Below is the correct way to set it up - and test it - and it works flawlessly.
Use this combo for each person (you need at least one of each type, all assigned to the person, to guarantee that it is 100% accurate - as long as the person never leave's their phone home!):
- GPS
- Router
- BLE
It takes about 15 minutes of not being home for all three of them finally switch to the phone not being there which is fine with me, my main issue was getting it to trigger as being home the second we arrive. Also, you would prefer to make it HARDER to say you are not home and not do so unless you are ABSOLUTELY SURE. Example: when perfecting this, as it was not working on our phones 100%, my wife's phone would show as not home when she was home, so when I left the home, things would turn off while she is still there! So, for safety reasons, it really is more important to have 100% accuracy about not being home but much more important to have you show as home the second you get there. There is a certain length of time that your router will take to decide your phone is no longer on the network and that varies by router manufacturer how long that is (I have Omada equipment and have found that it takes almost exactly 15 minutes). Only after all 3 show as not home then that person entity is shown as not home - because you want to be 100% sure they are not there. The above works flawlessly (but never for immedately after leaving, as per above, but always becomes correct, 100% of the time - and for returning, it is instant). This is the way! Example:
Notes:
The above is how my wife's location (home vs. not home) is tracked.
The above picture shows two "router" items. That is because I have two ways of tracking wifi connectivity to my wife's phone, both the regular router connectivity and then also as separate HACS integration for our Omada router. That is complete overkill, you only need one of the 'router' types.
Follow this paradigm and it will work perfectly. HA does do all the calculations for me using it this way and it does it very well. IMPORANT NOTES:
-
The BLE (Bluetooth Low Energy) IRK (Identity Resolving Key) I am using is the actual unique number on the phone. Therefore bluetooth needs to stay on, on the phone (unless you have a different BLE device on a keychain or the same). There are instructions for how to do this on the forums. You need at least one BLE sensor in your home that needs to act as a BLE gateway between HA and your phone. I have Shelly relays all over the place in my home so the gen2+ versions of those devices can also act as BLE gateways (so I only had to switch that feature on, but there are other ways of doing it, many HA sensors can also act as BLE gateways). Here are the exact instructions to get the IRK for any phone (you must follow the instructions to the letter and once you have the IRK for a device keep it stored somewhere because that is not only not easy to get but also never changes for the lifetime of your device). There are other ways but I have found this consistently is the easieest way for both an iphone and android of different versions - the section here that is entitled "On Windows - for any devices that will connect to a computer". There are other ways, all involved and many do not even work, but I have found this the easiest and most reliable.
-
IP address for the phone on the local network MUST BE static. To do so and make it work 100% properly, turn off anonymized mac addresses (in the phone wifi settings for the yoiur home network wifi connection) because most routers assign IP based upon Mac address of the device as the unique identifier for every device. If the phone in it's wifi network settings has an anonymized (or changing) mac address (supposedly a helpful security feature but no big deal to turn off as it is specified individually by wifi network and you trust your home network don't you?!), then the router will not be able to assign it the same IP address each time your phone reconnects to the network (because the router does not 'understand' it is the same device and gives it a new different IP address - as it sees every mac id or mac address as a unique device).
-
HA must be installed on each phone with full access rights (location etc.). Annoyingly, apple will very often re-ask the user to verify they want the HA app (or any other app for that matter) to continue to have full location reporting access. This does not happen with android. If the owner of the phone is a non-technical person, then just explain it is needed to ensure the house alarm functions properly (or some other related valid reason simple for in layman's terms - we also use our phones and HA to control a very robust alarm system).
-
GPS must always be turned on for the phone as well. Note that sometimes other apps on the phone might turn off the GPS.
This is the way.
For testing I set up some dashboards that I used in the past, for example for the same phone above, I have:
The one in the red rectangle is a combination of the others, as shown in the first picture, and is the sensor you use to act upon her being home or not home.
Once you have something like the above dashboard for testing, it's a simple thing to get in the car with your phone and drive 5 minutes away and just wait to test it, verify that once they all change to "not home" that the person changes to "not home", then go back home and see how quickly one of those sensor changes to make the person sensor also immediately say you are home. As mentioned before it is designed such that the person is considered not home only after ALL of the person related sensors have changed to not home, and then when you arrive back home as soon as any one of them changes to you being home then the person sensor will see you as home. Hope this helps, here is the source code for that dashboard card above for testing (note I renamed all the sensors that were working for each to a name that made sense once I dug up which were which). It's alittle bit of an excercise to update all of this when either of us gets a new phone! Note in the source code the above card is also using card-mod to make the text smaller so it is more convenient on a cell phone display, you can just remove that "card_mod:" section from the source code if you don't want to install card-mod... Note - I just changed this source code here, I now use "last_updated", not "last_changed" - for instance the GPS may be updated hundreds of times while the person is home all day, you want to know the last time it was updated (you could use both if you wanted....)
type: markdown
content: >
{% set sensor_issues = states
| selectattr('entity_id', 'search','person.cathy_ludington|cathy_s_iphone_17_pro_gps|cathy_s_iphone_17_pro_ble|cathy_s_iphone_17_pro_official_router|cathy_s_iphone_17_pro_hacs_router')
| rejectattr('entity_id','search', 'cathy_s_iphone_17_pro_ble_estimated_broadcast_interval|cathy_s_iphone_17_pro_ble_signal_strength|cathy_s_iphone_17_pro_official_router_reconnect|cathy_s_iphone_17_pro_ble_estimated_distance|cathy_s_iphone_17_pro_ble_power')
| sort(attribute='last_updated', reverse=true)
| list %}
{% if sensor_issues | length > 0 %} {% for s in sensor_issues %} {{
as_local(s.last_updated).strftime('%m/%d @%I:%M:%S %p') }}, {{ s.state }}:
{{ s.entity_id }}
{% endfor %} {% else %} Nothing to see here, there is nobody home (this is
actually never shown lol)! {% endif %}
title: 👩🏻 Cathy - Location Sensors
card_mod:
style: |
ha-card {
font-size: 12px;
}
ha-markdown {
line-height: 1.25 !important;
}
ha-markdown p {
margin: 0px !important;
}
.motion-row {
display: grid;
grid-template-columns: 1fr auto;
column-gap: 10px;
margin: 2px 0;
}
Hope that helps!
In return for my efforts above - can someone answer with a way to for me as HA admin to determine and get notified on my android phone if my wife's phone settings for the HA app' location tracking ability get turned off, or if GPS or Bluetooth are turned off? Because - Murphy's law - that DOES and WILL happen!???