Page 1 of 1

Delay sprinkler operations

PostPosted: Wed Oct 17, 2018 5:10 pm
by d3h872
Hello,

I'm trying to set up an Action Group to blow out our sprinklers:

(1) Turn on Zone 1
(2) Wait 15 seconds (purge zone 1 of water for this time)
(3) Turn off all Zones
(4) Wait 300 seconds (for the air compressor to recharge)
Then repeat steps 1-4 for each zone

The problem is that the wait/delay commands I've tried don't actually delay the next command. Maybe I'm misunderstanding how this is accomplished?

Thanks,
- Ryan

Re: Delay sprinkler operations

PostPosted: Thu Oct 18, 2018 3:46 pm
by jay (support)
Indigo is attempting to run all those actions at the same time (we attempt to parallelize actions as much as possible as that's what people normally want).

Rather, you should put it all in one python script file (it has to be an external file since it's going to take time to run):

Code: Select all
import time

# Adjust the following to match your system
sprinkler = indigo.devices[1234567890] # change 1234567890 to the ID of your sprinkler device
zone_index_list = [1, 2, 3, 4, 5, 6, 7, 8] # change this list to be a list of each zone that's defined for your sprinkler

# Get the index of the last zone in the list
last_zone_index = zone_index_list[-1]
for zone_number in zone_index_list:
    # turn on zone_number for sprinkler
    indigo.sprinkler.setActiveZone(sprinkler, index=zone_number)
    # sleep 15 seconds while the zone is on
    time.sleep(15)
    # turn off the zone
    indigo.sprinkler.stop(sprinkler)
    # sleep for 300 seconds only if this isn't the last zone
    if zone_number != last_zone_index:
        time.sleep(300)


Untested but it should be close.

Re: Delay sprinkler operations

PostPosted: Fri Oct 19, 2018 11:59 am
by d3h872
Awesome Jay, thanks so much! I'll try it out.