Evolving Software

I recently bought a fancy thermostat (more on that later) and I wanted to be able to have the thermostat automatically go into ‘away’ mode when I set the house alarm as AWAY. So I looked and I didn’t see any api available for my SimpliSafe security system. I did however stumble upon this article where the author reverse engineered the REST protocol from the phone app. So I’ve taken his specification and implemented it in Java

Get the source or jar.

The usage of the library is pretty simple. First just create a client

1
SimplisafeClient c = new SimpliSafeClientFactory().create("username", "password");

Then you can iterate through all of the base stations in your account

1
2
3
for(Location l: c.getLocations()) {
   System.out.println(l.getId() + "  " + l.getStreet1() + "  " + l.getSystemState());
}

and you can set the alarm state for any location

1
   c.setAlarmState(l, SYSTEM_STATE.AWAY);
Categories: Software Engineering
  • mkimberlin

    This is interesting…but isn’t it the opposite of what you want? Aren’t you wanting to get notification of that state change?

  • The api allows you to get the status using the following:


    System.out.println(l.getId() + " " + l.getStreet1() + " " + l.getSystemState());

  • mkimberlin

    Yeah, I saw that…but it means you have to actively poll it, right? So are you doing that and then setting your thermostat if it detects the away state? I certainly didn’t mean to condemn your efforts. Sorry if it came across that way. I was just trying to figure out if you managed to determine a way to push state change notifications rather than pulling them, since you’re wanting the alarm to trigger a change in the thermostat.

  • No worries .. no offense taken. Yea so you do have to poll it. The API is rest based and does not have any kind of push notification registration. If you wanted to make your code more event based, you could move the polling into a thread that caches the previous state, and then emits and event with a state change is detected. However for the purposes of a simple control library I was going to forgo that and leave it up to the implementing application to decide how it wants to mask the polling behavior.

  • John Gurra

    I reviewed the article you referring to, I see it accessing ../mobile/.. do I have to be mobile subscriber (Interactive $24.99/m) for this API to work?

  • Sam

    Ok so I know nothing about developing in Java. Seriously, nothing. I did however just download and install the latest JDK. Can someone please provide an overview on how to get this going? I’ve been tinkering with the Amazon Echo, and I’ve been able to voice control my TV, outdoor speakers, and cable box. I’d love to have this up and running too.

  • Paul J Hansen

    hey I am a complete newbie how do you do this and add to the hub HELP