Using iPhone activity (not geolocation) as a trigger

Has anyone attempted this? For instance, if I get into bed (sleep sensor) and there’s not activity on my phone, run an automation. The situation I’m trying to solve for is at night when I get into bed and stay up for a bit on my phone so I don’t want the automation triggered by the sleep sensor to run immediately.

I understand I can just use a verbal command (i.e. all lights off), but this would be a nice failsafe to ensure all lights are cut off in the event that I forget. Does anyone know if this sort of activity can be integrated into SmartThings, or is Geolocation all that’s possible?

Android allows a lot more third-party control of the phone and acquisition of information from it than Apple does. It’s one of their security things.

Still, You can do a lot more with an iPhone than you used to be able to as far as triggering automations through HomeKit, but that still doesn’t get you to Smartthings unless you were also using homebridge, in which case you would probably already know the answer to this question.

So… there are two ways to handle this that I can think of off the top of my head.

  1. treat the phone just as a physical object rather than an active participant, put a pressure sensor underneath the phone charger, and include the phone being physically on the charger as one of the conditions for your activity to run.

This is actually pretty straightforward and gives you direct integration into smartthings, you just have to think of it the way a maker would.

There was a community member who did a somewhat similar project a couple of years ago, but he wanted smartthings to be aware of whether his keys were hanging on a hook or not. It’s the same idea. You just use The weight of a physical object as a state you can measure.

Here’s the thread about the Keyes project. The topic title is a clickable link.

  1. If you want a smarter solution but you don’t want to bring smartthings into HomeKit, which is a whole project in itself, you can use the fact that iPhones can now read NFC tags, put a tag by the charger, and tap your phone on it when you go to put it on the charger. Then you can have the NFC tag trigger an Ifttt event to turn on a virtual switch that lets you know the phone is in place.

NFC sticker tags are really cheap, especially if you don’t need weatherproof ones, typically less than $.75 each depending on how many you buy. So you can stick different ones in different places in order to trigger different routines.

There is an advantage to method one in that it already has a difference in state, that is it knows the difference between “phone is on the charger“ and “phone is off the charger“. The NFC tag method is more like a scene, where you have to have a different tag for each action, it doesn’t really fit a “state“ paradigm.

————-

So either of those two methods will work without breaching Apple‘s third-party control rules, they’re just a little tedious to set up.

If you want something that is smarter than those, then you have to go to the HomeKit route and integration with smartthings gets more complicated.

I’m tagging a couple of people who might have additional ideas.

@jkp @Automated_House

1 Like

out of curiosity, what sleep sensor are you using?

not that it would be of use to me as my dog likes to sleep in my bed throughout the day. dang animals are a tough wildcard for smarthomes. but maybe it could work for the kids.

1 Like