I want my HA to do things when I leave or arrive home. I have tried for far too long to get an automation based on my location. I give up. iPhones just dont seem to cooperate. I have tried doing it through the HA app and the iCloud integration. The icloud3 might do the job but the instructions are impenetrable.
How about this. An automation that goes off when my iPhone leaves the wifi shared by my HA? This makes such sense, but perhaps I dont understand how wifi works.
I dont believe a ping will work. As I understand it, the iPhone will not respond to pings when it has been undisturbed for a few hours. So when I am asleep at night HA might think I’ve left.
The problem seems to be that once my phone is off my wifi it cant send a message to my HA. Maybe there is some way to have the iPhone automate sending am message to my HA when it leaves my home wifi network?
If it makes any difference, my wifi is provided by a google box.
Home assistant does have a sensor for my phone for the ssid. But I cant seem to make an automation based on it as a trigger. Can you tell me anything more?
There are other sensors I can use as a trigger. For instance, I can use step count as a trigger. But I cant seem to see the SSID sensor as a trigger.
The Companion App is able to monitor many aspects of your phone and report their values via sensor entities. However, many of them are disabled by default. You need to enable the ones you want.
Settings > Companion App > Manage Sensors
The list is categorized. Scroll down through the list to the “Network Sensors” category. Enable whichever sensors you want such as:
WiFi Connection (name of network the device is currently connected to)
WiFi Signal Strength (signal strength of the device to the WiFi network)
Thanks for the tip. I was able to get into the setting son the iPhone app. (Not easy. You need to be disconnected from your HA). My ssid sensors are on. I can see them in HA. I just cant see them anywhere in the automation screen. I can, for instance, make an autimnatuon triggered by a certain step count. But I just cant see ssid when I try to set a trigger.
Make sure you are using a “state” trigger and not a “device” trigger. In fact you should get in the habit of never using “device” for anything in an automation (neither triggers nor actions).
Create a Numeric State Trigger. Configure its target to use an entity_id then select your sensor from the displayed list. Then set a value for the trigger’s below option.
In the automation builder, under trigger I can choose a state. Under state it asks me to select an entity and I can select my phone SSID. It then offers me a second entity which I leave blank. It then asks or an attribute which I leave blank. It then asks for From and To.
Here is what is weird. If I put the name of my wifi in the To field and leave from blank the automation fires when I turn wifi on. But then, if I put my wifi name in the From field with To blank, it does the same thing. It fires when I turn wifi on. I cant get the automation to trigger when I turn the wifi off.
If you set up the iPhone detect integration, you’ll have a device_tracker.phone_name_used_in_the_config entity. Use that entity with a state trigger and a state from home to away and it will trigger when you disconnect from WiFi. Use the same trigger but with the states reversed for when you connect.
I want to use wifi connectivity status as an “at home” indicator to use to trigger different automations instead of GPS as I want to keep location always turned off on my phone.
When trying to use the wifi state options in the Home Assistant android app, it requires me to turn on location access for the app.
Are there any ways around this, or other apps I could use instead?
I had a very similar issue to yours where the automation would only trigger when jumping back on the WiFi rather than off. I’m pretty sure the automation logic is correct but believe there might be a bug preventing it from working correctly through the companion app. After several hours of banging my head against the table I used a router integration to instead detect if the smartphones had left the network. Can confirm it works like a charm using the same logic.