Presence and Scheduling Solutions - Your mileage may vary

Just wanted to share what I have been playing with in hopes it might help some folks. Seems that my SmartThings set up suffered from two issues; Reliable Presence and Scheduling.

Based on all the great work and guidance from this Community, I have used the following set up with success.


Wi-Fi detections seemed to be the most reliable but iPhones (all I’ve tested with) go to sleep and disconnect from the Wi-Fi. After watching this, the iPhone does ‘wake’ every 2-5 minutes to perform some function.
I created a SmartApp, device and Pi shell script that work to achieve the following:

  While x < 300 Check for phone with ping
    If answers
      If Phone was previously away
        mark it present with curl command
        x = 0
    If not
    sleep 1
  end while

  if Phone was previously present
      mark it away with curl command

end forever

For the ‘I’m Back’ function, I use both the virtual presence device and the mobile SmartThings app ‘built in’ presence detection. Both seem to detect the arrival at about the same time. Although, sometimes the SmartThings do not detect presence at all. It’s getting better though! I use this on three occupants.


Standing on the shoulders of @geko, I use the foundation of his pollster app to create a smart app that will poll devices based on a HTTP GET. I call the four polling group by four separate cron jobs (back to the Pi) that fire a different time intervals. It’s been very reliable.

I really struggled with the OAuth portion. Mainly getting the tokens, so I wrote the apps that require OAuth to text the URL to the HTTP GET command to a cell phone number of your choice on install. Just be sure to activate OAuth in SmartThings IDE.

I have placed the code in my Github. Note: I don’t consider myself a coder, more of a semi-experienced plagiarizing hack. So suggestions are always welcome!