Turn off pump to backflow clean filter

My Rachio 2 is working fine, but I’m having trouble with a filter clogging.

Setup is: Pond -> Pump (controlled by relay connected to ‘M’ terminal) -> Filter -> sprinkler valves.

The filter has a ‘flush’ port connected to a solenoid valve that feeds back to pond.

The problem is that when the flush zone runs, the pump still maintains ~20 PSI; the debris particles are pressed against the filter screen and don’t flush out.

I need to turn the pump off while keeping the flush zone open, so the pressure on the screen is reversed.

On the Advance Wiring screen, can I switch from ‘Well or Pump Start Relay’ to ‘Neither’ to turn the pump off? If so, is there an API to do that? Or, could I do this with Puppeteer or a similar web automation app?

Or, do you have another suggestion on how to cycle the pump power? (I could have a dummy zone that operates a relay that opens the pump relay circuit and powers the flush solenoid, but would greatly prefer a software-only solution if one is possible.)


I wrote a simple perl script to clean the filter. I could not find a way to control the pump relay with the ‘public’ API, so used the web API instead. If you have a similar issue (or any application that requires running a zone with the pump disabled), it should be easy to adapt this to your needs. On most local or cloud Linux servers, or on a Mac, the pre-installed perl should be compatible, without installing any prerequisites. On Windows, if you don’t have perl, a default installation from http://strawberryperl.com/ should be fine. Before running this script, edit the values of $user and $pass, as well as zones, duration, etc. as needed by your system. Let me know of any issues.


use LWP::UserAgent;
use JSON;

$user = 'rme@mydomain.com';     # replace with the email address for your Rachio account
$pass = 'sUper-s3cr3t';         # replace with your Rachio account password
$flushzone = 14;                # zone connected to filter flush port
$dummyzone = 4;                 # zone with no irrigation valve, used to repressurize system

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";

sub run1 {                      # args are pumpon (true or false), zone number, duration in seconds
    my ($pumpon, $zone, $duration) = @_;
    my $putdata = "{id: \"$devid\", master_valve: $pumpon, wellpump_delay_active: $pumpon}";
    my $resp = doreq('pump on or off', $ua->put("$cfg->{API_URL}/device/updateIrrigationController",
                                'Authorization' => "Bearer $token", 'Content-Type' => 'application/json', 'Content' => $putdata));
    return unless $duration;
    $putdata = "{device_id: \"$devid\", runs: [{duration: $duration, zone_number: $zone}]}";
    $resp = doreq('run zone', $ua->post("$cfg->{API_URL}/device/setManualSchedule",
                                'Authorization' => "Bearer $token", 'Content-Type' => 'application/json', 'Content' => $putdata));
    sleep($duration + 5);       # wait for completion

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

# 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")))

# do the real work
run1('true', $flushzone, 40); # run 'flush' zone to ensure pump is primed

for ($cnt = 0; $cnt < 3; ++$cnt) { # do 3 flush cycles
    run1('false', $flushzone, 10); # backflush filter
    run1('true', $dummyzone, 10);  # repressurize