evancg37 / Alexa-Pool-Control

A simple HTTP server that allows an Amazon Echo to interpret voice commands to operate an iAquaLink pool controller over WiFi
4 stars 2 forks source link

question: are you still using this? #1

Open craigham opened 6 years ago

craigham commented 6 years ago

Hi,

Just wondering if you have found the screen scraping to be reliable enough to use?

thanks, Craig

RByers commented 6 years ago

Note that I've started to have success with reverse engineering the REST API used by the modern Android app (no need for scraping). See https://github.com/RByers/pooltemp

craigham commented 6 years ago

@RByers really cool. I'll try and watch what you are up to.

blysik commented 6 years ago

@RByers can you share what you've reverse engineered? I was using a modified version of this project previously, but it seems like the recent outage screwed up the page layout.

RByers commented 6 years ago

Ok, I've put a scrubbed example basic exchange in this doc. That's what I used to come up with the code here. It was pretty straight forward - I just used Charles Proxy to intercept the SSL traffic from my Android device.

At some point I'm hoping to build a more full featured actions on google server so I can control my pool from my Google Home, but it'll likely be awhile before I get to that.

evancg37 commented 6 years ago

Rick Byers you are a pro! I'm glad someone was able to find a better way to do all of this than my attempt, HTML scraping and clicking things inside an invisible browser...

Thanks for taking this idea further! If I still had a pool, I'd be waiting for you to release your version.

RByers commented 6 years ago

Happy to help. If the protocol examples are useful to others I can easily augment them with other scenarios (changing temperature etc...).

blysik commented 6 years ago

Protocol examples would be awesome. I'd try to write something to, at a minimum, turn the spa on and off.

mcnutter1 commented 6 years ago

This is great, I was going to MITM the app but you did most of the work. Do you have any examples of control actions like enabling equipment or setting temperatures?

RByers commented 6 years ago

Sorry for the long delay, I finally spent some time on this today. I went through pretty much all the actions I can take in the app for my pool setup and recorded them in my protocol doc.

Some additional things not supported in my config are probably easy to guess. Eg. @blysik, I'd guess you could toggle the spa pump on and off with a GET to https://iaqualink-api.realtime.io/v1/mobile/session.json?actionID=command&command=set_spa_pump&serial=QX&sessionID=NX (with your particular serial and session ID values of course).

Feel free to request comment/edit access on my protocol doc if you want to ask questions there or add additional data for what works in your pool config. I'm planning on creating a reusable Go module (for Google AppEngine) for this and factor out the common logic from https://github.com/rbyers/pooltemp.

uotw commented 6 years ago

Nice hack of the API. I'm super impressed.

I've taken your documentation and created a PHP script to control my iAqualink with curl calls. I can't help but wonder if a similar MITM method could be used to snoop the actual device calls. As it sits now there's it's

  1. Alexa -> IFFT
  2. IFFT -> PhantomJS
  3. PhantomJS <-> iAqualink API //SIGN IN
  4. PhantomJS <-> iAqualink API //DEVICES
  5. PhantomJS <-> iAqualink API //HOME
  6. PhantomJS <-> iAqualink API //DO SOMETHING
  7. iAqualink API -> device

Taking out 3-5 of these hops would be nice. I looked into using Squid on my pfsense box to capture the calls, but I'm afraid of messing up my reverse proxy server configuration.

RByers commented 6 years ago

MITM the device<->iAqualink connection would be harder as you'd have to convince the device to trust your SSL root certificate. I don't recall if there's anything in the iAqualink setup UI for that. But personally the iAqualink API seems plenty powerful enough for me.

On Thu, Sep 20, 2018 at 9:53 PM Ben Smith notifications@github.com wrote:

Nice hack of the API. I'm super impressed.

I've taken your documentation and created a PHP script to control my iAqualink with curl calls. I can't help but wonder if a similar MITM method could be used to snoop the actual device calls. As it sits now there's it's

  1. Alexa -> IFFT
  2. IFFT -> PhantomJS
  3. PhantomJS -> iAqualink API
  4. iAqualink API -> device

Taking out 1-2 of these hops would be nice. I looked into using Squid on my pfsense box to capture the calls, but I'm afraid of messing up my reverse proxy server configuration.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/evancg37/Alexa-Pool-Control/issues/1#issuecomment-423388678, or mute the thread https://github.com/notifications/unsubscribe-auth/ABOJo8dlPN6BQqhes_wwwPTY_DhjkCHSks5udEaqgaJpZM4SjLVu .

scavuzzoj commented 5 years ago

RByers You did some great research with this!! I've utilized your examples to build an application that collects my pool data. I was able to figure out some of what I’m after, but there are a few real-time variables I still don’t know how to acquire. I’m looking for additional information including following:

I did notice my “get_home” command returns pool_salinity, spa_salinity, and cover_pool, but the values are always blank.

I'll also mention that some of these variables that I'm after can be seen from the iAquaLink "web" interface by clicking on the Status icon, as seen here...

image

Thank you for all your efforts.

Jim S.

RByers commented 5 years ago

Cool, glad it's helpful!

My chlorine generator doesn't report data back, and I don't have covers so I can't check that. But I believe anything available only in the 'Web' part of the app will not have an entrypoint in this API (seems like they added the API for the most common things, but fallback to the web interface for the larger variety of things). There's another project somewhere that tries to scrape / automate the HTML from the web interface, but that's brittle so I didn't want to go down that path.