Registration Code (Part 1): w%kQ6
Registration Code (Part 2): b<#$1[*(cw~
In order to register on this forum, you must use the codes above. Combine them into one code (copy paste).

Honeywell Total Connect (Windows Phone)

Programming topics that relate to the C# language.
Post Reply
User avatar
atom0s
Site Admin
Posts: 382
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

Honeywell Total Connect (Windows Phone)

Post by atom0s » Fri Jan 09, 2015 10:36 am

A while back I made a proof of concept application for both Windows and Windows Phone 7 to communicate with Honeywell's alarm system service as they do not offer any option for the Windows Phone 7+ platform. (Mind you this was when I had a WP7 phone. I have an Android now.) So I set out to make the Android version of the app for Windows Phone 7.

Before I begin: The information in this post is for educational purposes only. I do not hold responsibility for what you do with this information or source code. Use at your own risk.

Obtaining The APK Locally
The link to the APK on the play store can be found here: https://play.google.com/store/apps/deta ... armnet.tc2
We can see that the file name is ‘com.alarmnet.tc2′, Just add .apk to the name and Google. You will find a dozen sites with the APK. You can also root your phone to gain access etc. but I will not cover that here.

Decompilg The APK
Now that we have the APK we need to decompile it. You can use the following tools to accomplish this:
- dex2jar: https://code.google.com/p/dex2jar/

With this tool, you can easily convert the .dex file inside the .apk file (it is just a .zip file!) back to a usable jar file.
Simply drag and drop the .dex file onto ‘d2j-dex2jar.bat’ and you’re done.

Next to decompile the Jar to readable source code I used:
- Jd-Gui: http://jd-gui.softpedia.com/

Again simply open the .jar now with this tool and you will see the decompiled source.

Understanding The Source
While I do recommend looking through the entire thing to get accustom to their setup, I will point out what is important.
- com\alarmnet\tc2\rcmobile\rcConn.java
- com\alarmnet\tc2\rcmobile\rcSecure.java

Both of these files contain the service call data and connection flow that we will need to follow in our application. I really recommend studying these because their method of handling the connection is fairly convoluted in my opinion.

Making The Connection (Service Call Flow)
Now that we have the source, we can analyze the setup of the service calls and how they are handled. For one, we see the main service object can be found here:

Code: Select all

https://rs.alarmnet.com/tc21api/tc2.asmx
They were nice enough to use a Windows service so this makes things a bit easier while working with it at least. :)

To make a login request, we have a two step process:
- AuthenticateUserLogin : Which does what it sounds like, it auths our login information.
- GetSessionDetails : Obtains information about our session. (ie. Session Id, Module Flags, Security Locations, User Info)

To even login, we are required to give the service some information:
- Our Application Id
- Our Application Version

Given that the Windows phone does not have an appId/version for this, we use the Android one to fake the call. In the case of the code I wrote, the version info was:
- Application Id: 34857971
- Application Version: 2.2.0

The next step is to keep the session activated and alive. After we login, the app creates a thread to keep pinging the service. Inside that thread, the app was calling KeepAlive and GetPanelMetaDataAndFullStatusByDeviceID.

Thankfully, we are given the nice usage of async callbacks for everything when we reference their service. So we can make a fairly decent setup that can be UI friendly.

Arming Our Security System (And Disarming..)
Next was seeing how we arm and disarm the system. Here I found that the call was made to ArmSecuritySystem. This handled both arming for away and stay modes. This takes a number of params which I am not 100% sure if the user id param was required or not. I would recommend not sending it at all if you do not have to. My examples sent it just to be safe when I was testing this setup.

Following suit, to disarm the system we have a similar call: DisarmSecuritySystem

Status Information And The Like
Finally, with the information obtained status codes and bitmasks were all that was left to obtain the information data. When querying for the panel status in the keep alive, we can get a number of results that mean different things (based on different security systems):
  • 10200 – Disarmed
  • 10211 – Disarmed (bypass)
  • 10201 – Armed Away
  • 10202 – Armed Away (bypass)
  • 10205 – Armed Away (instant)
  • 10206 – Armed Away (instant-bypass)
  • 10203 – Armed Stay
  • 10204 – Armed Stay (bypass)
  • 10209 – Armed Stay (instant)
  • 10210 – Armed Stay (instant-bypass)
  • 10307 – Arming
  • 10308 – Disarming
When we arm or disarm the system, we can get a specific result return of:
  • 4500
When this occurs the system wants us to force-request the current panels last command state. When we do this, that service call can have the following returns:
  • 0 – Success
  • -4502 – Invalid pin. (Yes, that is a negative result.)
  • 4501 – Repoll Required (Command is currently scheduled.)
Also when we call the GetPanelMetaDataAndFullStatusByDeviceID method, we are given the current panels zone data. These zones can have a series of flags in their status mask. The status codes are as follow for the zones:
  • 0 – Normal
  • 1 – Bypassed
  • 2 – Faulted
  • 8 – Trouble
  • 16 – Tampered
  • 32 – Supervision Failed
Putting It All Together
When I first started working on this I made a simple test application which can be seen here:
Image

After getting the test app to work fairly well, I moved to working on the demo phone app I created. Which can be seen here:
Image Image

Getting it to work simply for myself was great. I was happy to get it in a somewhat working manner. However, I am by no means a Windows Phone developer. This was my first solo app project for the WP7 platform and I can honestly say my last. I am not a fan of Windows Phones at all and I have since gotten rid of mine and moved to Android.

About The Source Code
The source code is in a beta “working” state. Meaning, things are thrown together just to get it to work and test things out kind of state. I did not take the time to fully cleanup the code, it may [read: does] still have errors and problems. I cannot guarantee it will work for everyone and such. The following sources will be of my original test application (proof of concept) and the phone app.

I do wish that people at least honor me by giving me credits if you use this source code. I also do request that you do not sell your app, if you make one, for money. Honeywell offers this service free of charge on all other platforms, there is no reason to nickle and dime people for a simple feature-set like this.

Windows Proof of Concept Client: https://gitlab.com/atom0s/HoneywellWindowsPoC
Windows Phone 7 Proof of Concept App: https://gitlab.com/atom0s/HoneywellWP7PoC
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.com/cgi-bin/webscr?c ... Q2GRT6KUJN
transformers
Posts: 2
Joined: Wed Jun 14, 2017 5:48 pm

Re: Honeywell Total Connect (Windows Phone)

Post by transformers » Wed Jun 14, 2017 7:05 pm

Did you look into the possible arming types accepted by ArmSecuritySystem in the TC2 API? It doesn't really say what int values are accepted and what each would mean.

ArmType 0 seems to be for Away mode, ArmType 1 for Stay mode, but I can't seem to figure out which ArmType is for Stay (instant). I see that you figured out the status code that is returned from an Armed Stay (instant) mode.

What I'm trying to do is modify the code on this SmartThings SmartApp so that it also allows one to arm in Stay (instant) mode.

https://community.smartthings.com/t/new ... em/21248/7

By the way I didn't write the app. I'm trying to make it for for my use case.

Thanks in advance.
User avatar
atom0s
Site Admin
Posts: 382
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

Re: Honeywell Total Connect (Windows Phone)

Post by atom0s » Wed Jun 14, 2017 10:52 pm

I landed up ditching this project soon after I posted the sources I did. I now have an Android phone after all the roadblocks Microsoft kept putting on their system within WIndows Phone 7 and 8 which just really deterred me from wanting to keep the phone any longer. So I never really looked more into this since Android has a fully supported app from Honeywell already. In terms of what I found most of the info is within the Android app that can be decompiled fairly easily using normal APK tools. All of the API callbacks and info I used I got from that.
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.com/cgi-bin/webscr?c ... Q2GRT6KUJN
transformers
Posts: 2
Joined: Wed Jun 14, 2017 5:48 pm

Re: Honeywell Total Connect (Windows Phone)

Post by transformers » Thu Jun 15, 2017 6:45 am

I took a guess and used ArmType = 2 and it did put the system into Stay Instant mode. I didn't think it would be that easy.

Anyway, your work was really useful because I got the list of alarm states. I came across your site from doing several Google searches for this info. There aren't many people that posted this kind of stuff on the web.

I do use the Honeywell app on my Android phone from time to time. But with a SmartThings hub I have a home automation system which via the totalconnect API I can have it arm and disarm the system based on my phone's presence. There's a whole online community that create little apps like this.

Anyway, there were other people on the smartthings community looking for the Stay Instant mode code so hopefully they will find this info as useful. It may not be a really big deal to most but to me it was one of those "standing on the shoulders of giants" type of moments when I was able to use your work to figure this out. Your site is full of interesting projects. Thanks again for sharing and also taking the time to reply to my post.
User avatar
atom0s
Site Admin
Posts: 382
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

Re: Honeywell Total Connect (Windows Phone)

Post by atom0s » Thu Jun 15, 2017 10:24 am

Not a problem, glad to hear you found what you needed. :)
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.com/cgi-bin/webscr?c ... Q2GRT6KUJN
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest