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.

Tuesday, March 4, 2014

Integrating Spring with IceFaces

Since I spent hours and hours trying to find information on various forums on how to accomplish this when I first started using Spring framework and subsequently, IceFaces and since I've been using both for a couple of years now, I figured I'll create a sample project and hopefully make someone else's life just a little bit easier.

At the link below you can download a sample project that integrates Spring and IceFaces in Java.  It uses Maven so you'll need to get that installed.

Few things:
  • Download Maven here (I use 2.x, so using 3.x may require a couple of changes to the pom).
  • In applicationContext.xml, you'll need to reference a valid data source - you can create one in WebLogic and use a JNDI lookup or install a mySQL and use a local data source.  I provided examples of both.
  • I use WebLogic, but Tomcat should work as well as the application server.
  • To compile, do mvn clean install
  • To open the application, navigate to http://localhost:7001/example, if you are using WebLogic, or http://localhost:8080/example, if you are using Tomcat (port may be different in your configuration).
Hope this helps someone.  Let me know in the comments if it does or if there any problems.  Due to my workload and a new baby I won't have time to troubleshoot with you but I'll try to help if it's something simple.