Next scheduled watering for each zone is not in api, could that be implemented?

I would like to have the next scheduled watering for each zone to be available in the api. I need the next scheduled watering to integrate into my smart home, but for that it needs to be available in the api. I am sure that would be useful for others too

The zoneState for each zone includes a nextRun attribute with the time it’s next scheduled to run.

Here is a simple perl script that displays this info for the first controller in the first location on your account. Edit for your email and password before running.

I’m curious how you will use this data in your automation.

#!/usr/bin/perl

use LWP::UserAgent;
use JSON;

$user = 'me@mydomain.com';     # replace with the email address for your Rachio account
$pass = 'mysecret';            # replace with your Rachio account password

sub doreq {                     # print error and exit if request unsuccessful
    my ($name, $resp) = @_;
    return $resp->content if $resp->is_success;
    my $err = $resp->content;
    print "Request for $name failed: $err\n";
    exit(1);
}

$ua = LWP::UserAgent->new();
#$ua->proxy(['http', 'https'], 'http://127.0.0.1:8888/');

# get config data
$cfg = decode_json(doreq('config', $ua->get('https://app.rach.io/env.json')));

# log in and get access token
$token = decode_json(doreq('login', $ua->post("$cfg->{AUTH_SERVICE_URL}/token",
                                 [ 'grant_type' => 'password', 'username' => $user, 'password' => $pass,
                                   'client_id' => $cfg->{CLIENT_ID}, 'client_secret' => $cfg->{CLIENT_SECRET} ])))->{access_token};

# get first device associated with this account
$devid = decode_json(doreq('device', $ua->get("$cfg->{API_URL}/location/listLocations/true", 'Authorization' => "Bearer $token")))
    ->{locationSummary}->[0]->{location}->{deviceId}->[0];

# get and display zone data
$listzones = doreq('get zone list', $ua->get("$cfg->{API_URL}/device/listZones/$devid", 'Authorization' => "Bearer $token"));
print $listzones;

Thanks for that information, I have passed that on the the developer of the Homeseer plugin. I am planning to display the next scheduled watering for each zone on my main Smart home page, where I can see the status of my heating, temperatures and other sensors etc, I do not want to have to go into the Rachio app to do that, ideally I want to have all the information on my house in one page. With this in the api, that should be possible once integrated in the plugin.

Hello Stewart,

I am a bit confused. Are we authorized to use https://cloud-rest.rach.io/device/listZones/? If yes, is there any documentation? It’s not mentioned at all in the Rachio API. The web server also doesn’t return any of the API query details in the HTTP headers.

Regards,
Ultrajones

I obviously can’t speak for Rachio, but would hope that they would have no objection to using the web API in personal projects, provided of course that it was not abused e.g. by exceeding reasonable rate limits or attempting to access or modify data for a controller that’s not yours.

AFAIK there is no publicly available ‘official’ documentation, but Rachio doesn’t obfuscate or encrypt (other than by HTTPS) their site in any way, so you can just press F12 in your browser to see the API calls in action. As this ‘documentation’ provides examples that work properly in your system, it’s in some ways better than the official API docs.

I don’t understand your comment. Other than an indication of success or failure, one would not expect any response data in the headers – the result is transmitted in JSON format in the body. And ‘query details’ are not present in the response at all – the caller presumably knows what information he asked for so the response contains only the answer to the query.

Hello Stewart,

I didn’t realize that server was used by the Rachio web application. It would be nice of their official API provided access to a zone’s status (e.g. next and previous run time).

As far as the HTTP headers are concerned, when you query their API servers, they return API query statistics in the HTTP response headers. I didn’t see them when querying https://cloud-rest.rach.io/. It makes sense now that I know those servers are not part of their public API.

Regards,
Ultrajones