Undocking iPhone to 'wake up house'

project_presence

(Sander) #1

I’m going to mount a iPhone charging dock on each side of the bed on a hollow wall. Whenever my wife or i undock the iPhone between certain times in the morning I would like to trigger actions.
Because I don’t think the charging stopping can be used (cause it’s Apple) I’m thinking about a tiny motion sensor in the wall behind the phone. Any suggestions?


Is self-hosting to receive webhooks faster? (IBeacon processing)
#2

If you’re jailbroken iOS devices can trigger SmartThings endpoints via the excellent Activator app. Are you jailbroken?


#3

Different things work for different people. For me, it would not work to make this an automatic action from unlocking the screen because then if I was away from home at the grocery store and I unlocked my phone it would do all of the “wake the house” activities back at my house. :scream:

I do this two different ways. I don’t know if they would fit your use case.

One) I do use a motion sensor which is on the side of the nightstand pointed towards the bed. This means nothing else will trigger it. I just wave a hand over it when I want to trigger it, typically when I’m getting out of bed.

The tricky part here is getting the motion sensor positioned correctly. You can’t just put one behind the phone in the charger dock because then it will trigger as you’re putting the phone on the charger also. but if you find a good place to put it where you can trigger it only as you’re taking the phone down, then that can work very well. It also has the advantage that you can trigger it even when you don’t have your phone at all.

  1. I also use the official iPhone widget for SmartThings. This isn’t quite as automatic as a motion sensor, but it’s a lot easier than opening the mobile app. Once it’s set up it appears on your notification screen and then you just tap it to run whatever routine you want. You can access the notification screen from the lock screen also.

This SmartThings widget must be associated with the routine. So you first set up a routine to do whatever you want for “wake up the house.”

Then you go to “my account” in the SmartThings mobile app to manage your widgets which just means identifying which routines you want to associate with widgets.

Open the official SmartThings mobile app and tap the 3 vertical dots at the top right of the screen. Then choose “My Account.”

When the account screen opens, choose “manage watch and widgets.” This will open a list of all your routines and you can select which ones you want to associate with widgets. For example, I have about 15 routines, but only three of them use widgets.

Activate those widgets in your notification Center, and from then on they will appear whenever you open the notification Center.

Then, as I mentioned, you just tap the widget to run a routine. It takes longer to describe all this than it does to actually do it. It’s just one swipe to open the notification Center and one tap to run the widget. And that way it only happens when you intentionally want it to happen. :sunglasses:

I’m sure there are many other ways to do this as well, those are just the two that I use.


(Sander) #4

Nope not jailbroken, but I will have a look at that. :slightly_smiling:


(Sander) #5

Wow, thnx for your reply @JDRoberts. Didn’t know about this widget thing. Most of the manual control i do by voice with the Echo, but this is very usefull when I’m not home or outside. Very usefull!
But… I still like to trigger my house by undocking just because it’s fun :stuck_out_tongue:. I don’t think the motion detection on unwanted times should be a problem because i can set it up to only trigger once a day between for instance 7-8 in the morning on weekdays and 7-10 in weekends(?) Correct me if I am wrong.


#6

There are a lot of “filters” (restrictions) you could put on it, my own schedule tends to be pretty erratic so I’m not sure this would work for me, but it doesn’t mean it wouldn’t work for you!

Another option to consider would be using an IBeacon rather than a motion sensor. You can set the detection range on these to very small, about 6 inches, much smaller than a motion detector. Setting one up with SmartThings can get a little technical, but is doable. Or if you’re willing to purchase a paid app, SmartRules by @obycode used to have an IBeacon feature with the V1 hub, I’m not sure if it still does with the V2. It’s a very nice app and I found it well worth the $9 purchase price. ($7 for the rules engine, $2 for the IBeacon manager.)

http://smartrulesapp.com

The usual disadvantage to an IBeacon versus a motion sensor is that the IBeacon detection requires you to have your phone with you. Since your case involves detecting the phone’s proximity to the charging station, that problem goes away. So it’s just another option to consider. :sunglasses:


(Brice; SmartRulesApp.com) #7

Yup, SmartRules supports beacons as a device when creating rules. BeaconThings is a separate app that actually lets you connect the iBeacons to work with SmartThings. This app is available now in the US and pending official approval from SmartThings which will make it available for international users.


(Joseph Commisso) #8

I would use a energy monitor plug and see when the iPhone is using power. You would need to get the three voltages (I tried to find them but I could not). Charging, fully charged, and unplugged. Then you would have to write a SmartApp that basically says: If time is between {Early wake up time} and {Late wake up time} and voltage drops below {Unplugged voltage} trigger {Wake up house}. If you do not write SmartApps, I would not be able to do this as I’m just starting with writing SmartApps :disappointed:, but you may be able to find someone willing to do it in the community :grin:. Good luck!


(Jeff) #9

I agree a wouldnt a power meter work? unplug the phone and the power change triggers the mode change? I may give this a try its a great idea! it may not be hard to adapt the laundry monitor app to do the job


#10

Hey there,

I am JB (of course). How do i create ST triggers with Activator?

Thanks


#11

The easiest way is to use this Endpoint Example:

http://107.20.127.54/smartthings/exampleOauth.php

From this tutorial:

Once you’ve authorized the Endpoint Example app, let it control one or more of your devices. Hit ‘authorize’ and on the following page you should see ‘on’, ‘off’, and ‘toggle’ options for your devices. Right click any of those buttons and copy the link to your clipboard.

You should get a link that looks like this:

http://graph.api.smartthings.com/api/smartapps/installations/numbersandletters/switches/numbersandletters/on?access_token=numbersandletters

Don’t share your specific information with anyone, since that URL allows anyone to interact with your SmartThings devices.

Now open Cydia and make sure you’ve installed the cURL package.

Finally, build your activator action by going to Settings.app -> Activator -> Anywhere -> Screen Bottom Center -> Build in the upper-right corner. Choose “Run Command” from the options given, give it a decent title and in the “command” section you will input the following:

curl -k -s https://graph.api.smartthings.com/api/smartapps/installations/numbersandletters/switches/numbersandletters/on?access_token=numbersandletters

Do notice that the URL above when copied from the switch is just http://, but when you feed it into Activator it needs to be https://

Now press Save, Done, and then assign the command you just built to any Activator action of your choosing.

In the future, if you want to assign more actions to different SmartThings devices, simply go through the process of using that first Endpoint Example link and add the button link information to Activator as explained above.


#12

Wow! It is rather complicated - more than i thought it would be. Unfortunately i do not have enough tine to go through this now. Hopefully i will manage to make some time and try it out.


#13

No pain, no gain :slight_smile:

20 characters.


(Sander) #14

Very useful info, great idea using a power meter. Will play around with that asap and keep you guys posted. I have no experience writing a smart app, but one has to be the first. :slightly_smiling: