Hey folks, I recently bought a Sutro device to help me monitor the water quality of our hot tub. The Sutro app is pretty great but I wanted to see the water quality stats in my all up home dashboard which was built using Home Assistant + Lovelace. Unfortunately, Sutro doesn’t have an integration with Home Assistant (or pretty much any smart home ecosystem) so I decided to build my own. I reverse engineered Sutro’s GraphQL API (used by their iOS app) and used it to retrieve the information about my device. Authentication works via a token that you have to scrape from the network traffic generated by the Sutro app. This token right now appears to have a ~996 year expiration time so there is no need to refresh it.
Thanks for this, just got it installed and it seems to work great. Just for those who may come after me, I had to slightly adjust your instructions for getting a token to use single quotes around the --data-binary value to avoid having to do a bunch of escaping of all the nested quotes. My updated command line looked like this:
@raphs, after you have added the custom integration via HACS you should be able to configure it by going to Settings > Devices & Services > + Add Integration and then search for Sutro:
I was just able to figure it out. I had tried Command Prompt, Power Shell, entering in a browser, all with no luck. For anyone else looking for this answer, I had success entering the command in a terminal view of “Studio Code Server” from within Home Assistant.
I am SO excited that someone took this on! I have a Sutro and I absolutely love it, but really need to be able to pull the data into HA.
I feel like i’m pretty savvy, but I can’t for the life of me figure out now to get the token. I tried Charles Proxy on my Mac and on the iPhone and while I could see the traffic coming from my iOS app, I couldn’t see anything that seemed to be what the integration is looking for in terms of a token
Would someone be so kind as to walk through the process (maybe just a touch simplified) of getting the token? I didn’t know where to enter the command that was talked about here either.
Sorry for the pita question, I just really want this to work!
Ha this is awesome! I just last week made a script to screen scrape the my.mysutro.com website and get this data. This is so much better. Thanks nice job.
@RTech73, did you try following the instructions shared by @rwestergren and @imbriaco above? They are much easier to follow than the proxy-based method I had originally suggested.
Repeating here for convinience:
You can generate your own token from a login request like this (replace EMAIL and PASSWORD): curl --header "Content-Type: application/json" --compressed --header "Connection: Keep-Alive" --user-agent "okhttp/3.12.1" --data-binary '{"operationName":null,"variables":{"email":"EMAIL","password":"PASSWORD","focusedInput":"","loading":false},"query":"mutation ($email: String!, $password: String!) {\n login(email: $email, password: $password) {\n user {\n firstName\n lastName\n email\n phone\n releaseGroup\n __typename\n }\n token\n __typename\n }\n}\n"}' https://api.mysutro.com/graphql
I did see this, but I am embarrassed to say that I don’t know what to do with it. That was what I was referring to when I said I don’d know where to enter the command that was talked about here. Is it an HA command? Mac Terminal? Is what is here a direct copy/paste (obviously changing the EMAIL and PASSWORD variables)?
EDIT - OK, apparently I was reading through the thread too quickly. Eric posted the answer I need! Going to go try again!
FINAL EDIT: I am embarrassed to say that I actually did this right last night, I just didn’t recognize the token in the response from the command. I just entered it into Terrminal and it worked like a charm and then the integration fired right up. This is AWESOME!!!
Glad you like the automation! Careful with that Alkalinity Up since it might push your pH out of range and I find that to be the more important number.
And don’t worry about the tip jar. This has been truly a team effort. Because of community contributions, the integration now supports a slew of new sensors and can be configured with a username/password rather than token.
I certainly enjoy having it! Saves me a lot of time doing manual tests and I’m alerted to the need to add chemicals in almost real- time so problems don’t really have time to develop, saving me from having to correct a bigger problem!
I personally bought a hot tub with a built in chlorine generator since I wanted it to be as hands-off as possible. Even so, I quickly discovered that keeping the water balanced was a huge chore and one that I kept failing at miserably:
I first tried at least five different brands of test strips but could never get consistent and accurate readings with those. I think my red-green color blindness didn’t help.
I then bought a Taylor Test Kit and tried using that for a while but it also required you to compare color swatches of transparent liquid making it very challenging to get accurate results.
Finally, I decided to look for something more automated that did not require me to squint at colors. I considered a few different digital test kits but all of them seemed to require keeping a stock of fresh test reagents on hand and manual sampling of the water.
So that’s how I ultimately landed on the Sutro. So far I’ve been very impressed with the device. Everything from the packaging, to the software, and the company’s very responsive customer service have exceeded my expectations. Yes, the device + subscription are pricey but I personally think the crystal clear water and convenience I get in return make the cost worth it. I also find that the Sutro lets me find out exactly when it’s time to change my chlorine generator cartridges and avoid wasting hundreds of dollars on premature replacements.
Having said that, if you’re managing to keep your pool’s water balanced and sanitary using test strips or whatever measuring instruments you currently have at your disposal, then you probably don’t need a Sutro.
Do you require a subscription for this? I am wondering if you can flash this to esphome since the internals are an ESP chip for wifi, STmicro for the 915MHz radio, and the microcontrollers are Cortex
Yes, there is a subscription fee and it covers the cost of the reagents which are necessary to take the measurements. Even if you could make the device work without the Sutro app/cloud, you would still need to figure out how to get replacement test cartridges:
I do think it would be better if you could have the device only take one measurement per day instead of three which could in theory allow the cartridges to last 3x longer and the monthly subscription much lower. Hoping that happens in the future.