nfarina / homebridge-icontrol

iControl (Xfinity Home) for Homebridge: https://github.com/nfarina/homebridge
7 stars 2 forks source link

Trying to re-build this plugin #5

Closed mrjackyliang closed 5 years ago

mrjackyliang commented 5 years ago

Hey @nfarina, I was browsing your code earlier, and I don't seem to understand how the plugin connects to the iControl API. I tried messing around with the HAR files, but got nowhere.

Would it be okay for you to explain how the plugin connects to the iControl system? I use ADT Pulse, and I can't even get past authentication yet.

Thanks!

mrjackyliang commented 5 years ago

Right now, based on dumping HAR files (I learned you can do so by @adriancable), and I got several URLs that seem to connect to the iControl one front-end. Somewhat sloppy, but it's cause I can't figure out where the iControl one API is.

Since it was the front-end, I can't seem to find anywhere on the page to poll the status of the alarm, but it does show the status on the page as text.

If you guys can help me out on this that'd be awesome. In the meantime, I'll just let this squat here.

Authenticate:

https://portal.adtpulse.com/myhome/15.0.0-130/access/signin.jsp?usernameForm=email%40email.com&passwordForm=thepassword&sun=yes

Disarm:

https://portal.adtpulse.com/myhome/15.0.0-130/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=away&arm=off

Arm Away:

https://portal.adtpulse.com/myhome/15.0.0-130/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=away

Arm Stay:

https://portal.adtpulse.com/myhome/15.0.0-130/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=stay
nfarina commented 5 years ago

Hi!

So I was able to connect to the iControl servers by reverse-engineering the protocol used by their iOS app. I used the Charles app on macOS to assist with this.

Reverse engineering an API like this is not for the faint-of-heart, as you've seen. The servers can be quite finicky about what they accept, and it takes a lot of guesswork to make it work.

In my case, I was able to make it work but an obscure bug in the request JS library I was using for communication was breaking my client implementation. I basically ran out of time to fix it since this is just a hobby project for me.

I've since switched away from iControl and am now using Nest Secure, which is even less hackable but at least has a superior UX.

So, long way of saying I can't help you much I'm afraid! But I wish you the best of luck. If you figure it out, I'm happy to give you maintainer status of this repo since I can't really contribute anymore (not owning a system to test against).

Nick

mrjackyliang commented 5 years ago

It's okay Nick! I think I found my way around making the system work through the front-end website. The APIs are somewhat difficult to access, but I got most of what I needed so far.

Might not be iControl compatible, since their structure and versions are different for some reason (even being white labeled), but I'll see if I can figure it out!

Thanks for getting back to me!