Connected to WiFi = Inside home.zone

Currently I’m exploring the possiblities to have a person who is connected to the wifi is registered as in home.zone.

Right now I myself as an Android user and my GF as an iPhone user. But the problem is that the iPhone says it’s tracking the location, but obviously isnt. So when she get’s home or leaves the home. It’s never registered the right way.

Currently I’m running a Omada network at home with some AP’s.
I would like to ideally have a function or something that goes like:

If [phone.from.gf] = connected to WiFi, then she’s home.
If [phone.from.gf] = not connected to WiFi, then she’s not home.

Is this something to achieve easily? I’m currently looking through a lot of things. But I’m afraid I’m either too dumb to understand.
Anyone have a guide on how to set this up?

The sole thing it needs to do is to check the WiFi and see if my GF’s iPhone is connected yes / no.

Thanks!

You don’t say whether you’re actually running HA or just thinking about it… :grin:

This is easy to do with phones which have the HA companion app on them - wi-fi state and wi-fi connection for each phone are among the sensors updated in Home Assistant. Alternatively you can set up a home zone based on Home Assistant’s location and track devices entering or leaving:

The trouble is that all phones sleep periodically to conserve battery, so a single sensor is probably going to be unreliable. You need something else as well, such as a bluetooth beacon.

All doable, though.

You just have to make your router a device_tracker … and add it to the person tracked.

Hi Jack,

I’m currently using Home Assistant. Sorry for not clarifying.

So, if I understand correctly:
My Android phone & my GF phone have the companion installed.

I set up a home.zone, in the event my GF or myself leave the house and the home.zone = 0.
Depending if the home.zone = 0 or more than 0, it should turn on / off lights.

My Android phone does it perfectly. My GF’s iPhone doesn’t.

Even if she opens the companion app, it fails to register where she actually is.

Possibly, it would be good enough to track the event “I`m Home” by pinging your phone. There is an integration Ping (ICMP), that returns state Available / Unavailable
In this case you should set on your router DHCP leases for smartphones to set them “static” IP address. Then you can set your automations to track PING entities states

That doesn’t work, iPhones go into power saving mode and stop replying to pings.

The HACS integration iphonedetect works around this issue by sending ARP messages which the iPhone respond to even when in power saving mode.

2 Likes

Ok, maybe another way
Companion entity “WiFi Connection” should change state to “Your WiFi name”

That works only if the companion app is active and only if the companion app can communicate with HA when not on WIFI (e.g. via internet and Nabu casa cloud). So for example, if you turn the phone off and leave the house that states will never change. If you leave the WIFI coverage and don’t have Nabu Casa for internet communication it won’t work either.

Don`t have Apple devices to check.
Maybe some logical checks. E.g. if some counters do not change for a while, set AWAY. When they change - set HOME.
I would try to track entities like phone battery level (except on charge), Total Tx, Total Rx, etc

For now, I’ve set it up that it will detect if my girlfriend is home. But didn’t include her phone in triggers anymore.
I have put this on the backlog. Maybe in the future if she get’s a new job, she’ll have an Android again and make my life a bit easier.