Developer Challenge

Since the contest is still on hold, I’d like to post a challenge to my fellow ST Developers. And yes the ST Employees can join in too. You can work on it as an individual, as a team or whatever other combination you want as long as the code posts here or in projects for all to share (not sell, jking @ CP). Anyway, I also challenge ST to kick in for a prize for the winner (something more than a tour of Urman’s brain[Scarry]).

Anyway, here is the challenge:

Mr. Brown must take the train everyday from San Francisco to San Jose. If he gets off work at certain times he can catch the express train which get’s him home 25 minutes earlier then the regular trains. He likes to have the spa warmed up and the house at the right temp when he gets home. He also wants to automatically send a text to Mrs. Brown when to pick him up at the station.

So the trick will be to determine what kind of train Mr. Brown is on and how to schedule/trigger the spa, thermostat and wife.
Anyone up to it, or everyone too busy?


How long does the spa take to warm up? How much warning does Mrs. Brown need? Can we use outside services or does it all have to be in SmartThings? Is there only a hub at home, or is there one at work too?

Do you need actual code or pseudo code work?

Mr. and Mrs.Brown each have the app on their phone and mobile presence. Decide for yourself on the rest, ie user inputs learned times, etc.

As for code, let’s do some real stuff.


No one interested?

Hubless location at work (or get a hub for work too!) and a time-conditioned mode change to e.g. ‘In transit - Early’ or ‘In transit - Late’ based on when mobile presence exits hubless work location geofence. Then two apps installed for specific modes (one for early and one for late), that fire up thermo and hot tub and send appropriate pickup push?

Bah my idea doesn’t work as the separate location SmartApps don’t currently ‘talk’ to each other. I will inquire internally about the prospect/possibility of this in the future and defer to the community and look forward to hearing other ways to solve for this!

They don’t have to directly talk to each other. You could use the SmartThings web services and have the app trigger events in another location.

Can mobile presence handle multiple locations?

Yes Mobile Presence can handle different locations. For example I have a location A with a hub and a mobile presence added. I am outside the geofence of location A. I created a hubless test location B (skip the add hub step), and then added the same device as a mobile presence to that location. I am inside the geofence of the test location B. On the Location Device Matrix view for each location the presence appears correctly as ‘present’ at B, and ‘not present’ at A. Please let me know I can provide more info or anything, thanks!

In that case, you could create a SmartApp that watches mobile presence at work and just sends a web service call to another SmartApp running on the home hub. The SmartApp on the home hub could then handle all the notifications and switching based on time.

I haven’t played with communicating with SmartApps using web services yet.

So David, can I write an app that talks to, or hears from, an app installed in other locations (Hub/Non-Hub) through the common device? Am I understanding you right?

To put it more my style; Can I write a mobile presence app, install it in the home location and then have that app ask the device if it is within another location’s geofence? Can I subscribe to the device’s presence change regardless of which location?

Hope I’m being clear,

And by the way, if this challenge does role through, instead of a prize I will pick someone to receive a thing gift from me. Due to the Lawyer-fication and rules in some up-tight states. Prizes require a bunch of lawyer crap for the dumb-@$$'s that troll for anything that can in any way be unfair to the millions of possible victims of prizes.

So, Happy Hacking! You may get a gift… Or not.

@dianoga yep that sounds like the move.

@wackware thanks for the great questions and ideas and fun. :slight_smile: I’m inquiring with our engineering team, and Dan Lieberman has noted “You could use SmartApp web service endpoints today without the OAuth2 client code, but you’d have to manually follow the OAuth journey to generate an access token.”

Will inquire in-house and post when have more info, thanks!

Any update on this research? I am also looking for a way for a mode change to be triggered on my Home location (has hub) based on mobile presence leaving my Work location (hubless).


Try using IFTTT location based triggers:

We are an all Android household…:). It doesn’t appear that there is an equivalent Android Location channel.

Also it does seem that mode change is exposed on the ST channel.

Thank you regardless!

@eran your reply got me thinking in a different direction. I am going to look into using Tasker to determine geofence and call a web service endpoint of a smart app that changes mode. Seems like a long ways to go to address something that should be able to do natively, but I think it will work.

I’ve been looking at trying to set something like this up, I walk to and from work and want to trigger certain things as I’m leaving the office. The problem with using IFTTT? It’s too simple. I can’t set specific times of day/days of week to check for presence, meaning every time I pass by the office on my way through town on a Friday night or Saturday afternoon, the recipe would run.

Any word on built-in location-to-location support, or any other easy way to do this?