Help setting up iphone shortcuts (personal automations) to change virtual switch in Maker API

I would like to know how to setup personal automations in iphone shortcuts app to turn on/off virtual switch (public) to use with Leave/Home for presence detection.

That may prove difficult as IOS does not allow you to run an automation automatically based on presence. You can set them up but it pops up a message each time asking you to run it, which kind of defeats the purpose. I saw some messages about somehow using focus settings to do it, but it wasn't important enough for me to go and try to figure it out. My Geofency presence , along with Alexa and the HE app have been working well enough.

Can you restate the question? I am not clear if you are trying flip a virtual switch based on presence? Or are you trying to do something with the shortcuts app to manually flip a virtual switch via Maker API / Rule machine?

Actually many people use and recommend this, you can flip "lights" (virtual switch) on and off based on arriving and leaving home very easily in the HK automations. I use it for presence detection. Just need to get a new Home Hub so it will work again, since my HP Mini crapped out after only 2 years of service!

Correct I am trying to flip a virtual presence device state by way of the Maker API "command/arrived" "command/departed". And I am trying to use the home/away automation triggers in iphone/iOS shortcuts to achieve it.

I do the same thing with my android using tasker and autolocation. it is responsive to the meter and updates instantly as well as turning on precision location detection when I reach a geofence called 'service area' so that it more accurately tracks the phones position upon reaching the 'home' geofence.

I tried owntracks and it is so incredibly slow to update its data it is pretty much worthless.

If anyone could also instruct me on how to setup geofency I'm game to give it a go. I couldn't even find the app on the app store. unless it is indeed the geofency time tracker app for $4.99??

From a little searching, using shortcuts is what will cause the alert to pop up for confirmation every time. @terminal3

The only way it works without an alert is using the HomeKit integration, and Home automations (not a shortcut). The only catch is you need an Apple Home Hub of some sort (HP Mini or ATV Gen 3+ I think will work).

You just share a virtual switch/presence combo device to HK, then setup an automation to turn it on/off via arriving and leaving.

The best non-Apple hub options for iPhone are Geofency and Locative. No virtual switches. No prompts. No Apple hub.

can you answer my question about the app store, it is the one for 4.99 called 'geofency time tracking'

Also, if so can you please give me a rundown on how to get it up and working. I'm not an iphone person, strictly android.

That is the one. Here's the instructions on Hubitat integration:

1 Like

Is it possible to use the HE integration for HomeKit and setup an automation on iphone in home, but instead of setting the virtual switch to communicate with a home pod or like, have the home app in iphone process the url get contents as it would in shortcuts?

No. You need an Apple TV or Home Pod to run Apple Home automations. And Home automations don't do URLs.

1 Like

Then how do they achieve practically the same concept in this post:

I was wrong about URLs from Home automations. But if you read down that thread you'll see a home hub is required. Because it is using Home automations.

The 3 non-Home hub options are Geofency, Locative, or OwnTracks. I'd stay away from OwnTracks as it is the quirkiest to set up and has lots of options that are not likely useful for most users.

Yes, thank you... I went ahead and installed Home app and then linked to HE HomeKit integration and added accessory virtual switch and absolutely to do automations is clearly shows with images need home hub of some sort. Too bad.. Guess I'll give Locative a go...

Thank you

You would need to setup a personal automation that runs only on the iPhone. Try this to see if it will work; though, I'm not 100% confident in it:

For Arrival
1.) In Rule Machine, create a rule. The trigger should be a cloud endpoint (save the link created from the endpoint). The rule should turn on a virtual switch with presence.
2.) Go into the Shortcuts app and select automation at the bottom.
3.) Hit the plus sign and add a new personal automation
4.) Select arrive and choose your location. You could also select connect your home WifI instead. Make sure to select Run immediately.
5.) For the action, you want it to Get contents of URL and have this be the cloud endpoint created in Rule Machine.

The issue I have seen is the run immediately is not reliable, but the above is the general gist to creating automation that only runs on an iPhone and does not require a Home Hub.

Not sure if this is relevant (and it doesn't involve HE)...

A few weeks ago, I tried to set up my first iPhone automations. Based on me leaving/arriving home, I wanted to "flip" Wifi and cellular data (on/off). All I was able to accomplish was to get a notification/confirmation message, i.e., it wouldn't make the changes automatically. There was no "run immediately" option available in the automations.

I upgraded my iPhone from iOS 16 to 17.2.1, and the "run immediately" option showed up. The automation choices now shows "Run Immediately", "Run After Confirmation", and "Don't run". So far (only left home a few times), it works as hoped/expected.

Your experience of having to manually start an automation was what I saw the last time I tried to do this, and I also gathered from web searches that this is teh way it was. That probably was a few revisions ago, so maybe they fixed that issue.

Awesome feedback, thank you so much for reply!

Just saw this topic. I'm using both Locative and HomeKit automations (both of which have a similar setup). Locative has a great tutorial here:

https://community.hubitat.com/t/locative-presence-app-for-ios-full-setup/132985

And here is a topic specific to using Home app automations. These have been bulletproof for me. There are a couple of links in that post to how to set it up. If you can't figure it out, I'd be happy to help out.

https://community.hubitat.com/t/arrive-home-iphone-presence/104581/5?u=diverrich