Saturday, March 8, 2014

Presence Detection Using Mobile Phone for Lowes' Iris System

One of the pitfalls of using Iris by Lowes is a poor mobile app and the lack of ability to be able to use my mobile phone to detect presence in the house.  Sure, Lowes offers a keyfob to do that but that thing is huge and hideous and looks like it came straight out of the 1980s.  Also, there is really no reason why in the year 2014 we are not able to detect user's presence using mobile phone.

Since I could not find any solutions online I decided to create my own.

My solution consists of the following:

  • Java application that pings my phone (and my wives) every second to see if phones are present on our WiFi. Any number of phones can be added through the settings file.
  • Once both phones are abent for X amount of time, the application will login to Iris and set home mode to Away, triggering any magic rules associated with it.
  • Once one of the phones arrives and connects to WiFi (in my case, it happens before  I get out of the car and open my garage entry door), the application will set the home mode back to Home, again, triggering any magic rules associated with it.

Since I was creating the app anyways, I decided what the heck, why not include some additional functionality.  So the same application also contains a web server that accepts commands so that you can turn alarm on/off, set home modes, and do some other things (I'll add functionality as time goes on).

On my TODO list is the following:

  • Replicate all native app functionality
  • Create a mobile web app with a nice user interface using one of the Mobile apps frameworks such as Jquery Mobile.
  • Interface with iCloud to get phone location using GPS
  • Create a native app (this one may be wishful thinking as I am not an iOS developer)
Let me know if you are using this app and how it's working for you.

Download it here: IrisTools1.0
Access docs here: docs1.0

NOTE: Make sure you edit the iristools.dat file (must be placed in the same directory as IrisTools.jar) and provide your Iris login credentials as well as comma separated list of your mobile devices. 

To run the jar use the following (make sure you have Java Runtime Environment installed): 
java -jar IrisTools.jar

Basic usage of the built-in web server:

Set mode to away: http://localhost:8080?command=setProfileAway
Set alarm to on: http://localhost:8080?command=setAlarmOn

I also included a simple alarm.htm file that you can open and use to control profile and alarm modes.  I plan on making a full featured web frontend at some point.

For full list, use the docs link above and click on the IrisApi class.

At this point, consider this a beta software and I take no responsibility for any damage it may do (although I am running it on my Mac with no issues).  This application does not transmit any of your information to any server other than Iris servers - you can verify this by using a web traffic analyzer of your choice.

I would like to get some feedback from someone who is running this on Windows or Linux.

2 comments:

  1. Hi Yurily

    I am trying out your api and am getting errors. Do es the api still work with iris? Here are the errors I recieve.
    Waiting for commands
    Started presence detection on Fri Nov 07 12:55:07 EST 2014
    java.net.SocketException: Software caused connection abort: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
    at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
    at sun.net.NetworkClient.doConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewH
    ttpClient(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Sour
    ce)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
    (Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown S
    ource)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unk
    nown Source)
    at com.eightydegreeswest.iristools.api.IrisApi.login(IrisApi.java:81)
    at com.eightydegreeswest.iristools.api.IrisApi.(IrisApi.java:60)
    at com.eightydegreeswest.iristools.IrisServlet.performCommand(IrisServle
    t.java:101)
    at com.eightydegreeswest.iristools.IrisServlet.run(IrisServlet.java:83)

    ReplyDelete
  2. Jim, you are most likely have a firewall, which is blocking connections to https://api.irissmarthome.com. I remember having this issue in the past when I tried to run it on a different network.

    ReplyDelete