I’m successfully using the Rachio API to pull information, but examination of the JSON data that comes back for a Zone does not seem to have a specific field that clearly tells me the most simple fact about the zone: Is it running right now?
I’ve been capturing the json text in both running and non-running states and diff’ing the text to try to figure this out. It appeared that while the zone is running, the lastWateredDuration field is not sent, and that after the zone stops running, it is sent. But I found that other zones that I’ve not run lately also do not send lastWateredDuration in the response, so I can’t simply test that field.
It’s frustrating to me that the json information I get from an incoming web hook callback for a ZONE contains different information than the information I get for a Zone either from reading the Person object or the Zone object.
In the web API, calling GET https://cloud-rest.rach.io/device/getDeviceState/(controller ID)
when idle includes "state":"IDLE"
and when running includes (for example) "state":"WATERING" ... "currentRunningZone":{"index":0,"zoneNumber":1,"paused":false,"start":"2021-08-07T23:39:37Z","end":"2021-08-07T23:42:37Z","type":"IRRIGATE"}
I visited app.rach.io in Chrome (though Firefox is almost identical in this regard), pressed F12 to see network traffic, selected XHR and looked for interesting calls.
There are many functions used by the web API that are not exposed by the public API.
The thread below has a simple program using the web API.
Yes, undocumented API is nothing new in the product development, Rachio is not the only one to do so. It mostly comes down to reserving the right to change the full API without notice, whereas public / documented API is supported on a more permanent basis (features may be added, but not changed or removed). Using the full API, by sniffing the developer tab, comes at a risk that your app may break, without a clear indication why, more than good enough for DIY, terrible for published shared apps.
I can’t thank you enough, Stewart. And Gene, thanks for your comments too. I’m a retired software professional and I totally understand the business reasons for Rachio not fully documenting their API. Yes, it’s a pain, but I am still very pleased with Rachio just because I CAN do API stuff with my device!!!
Stewart, I did a quick run on using F12/XHR in Chrome, and I now should have everything I need to proceed with my home automation project.
OK, I just made myself a note on how to investigate the additional API calls based on this thread.
Posting here fin case it helps others:
The documented API is hosted at api.rach.io. But there is a more powerful undocumented API that is hosted at cloud-rest.rach.io. To figure out how it works, do the following:
Hit F12 in Chrome to open the developer tools window.
Click on “Network” on the top menu of the developer tools window.
Click on “Fetch/XHR” in the developer tools window.
Now, use the Rachio web page to do different things. Each time you interact with the web site, the background REST API calls are listed in the Fetch/XHR window on the right. You can study any message of interest and see the format that is required to use that API call.
NOTE: The “Big Boy” warranty applies. If something changes or does not work, it’s your responsibility to be a big boy and figure it out. Not bitch at Rachio.
Can I use this in a Node-Red HTTP Request Node ? I tried it with my username and password (the credentials I use for the app) but I get HTTP 403 (gRPC: PERMISSION_DENIED)
Any idea as to what I am doing wrong please ? Is the Controller ID the “Serial No” ?