How to temporarily pause/resume a running program
Greetings,
I'm trying to figure out a way to pause a program "mid-zone" programmatically (I'm using the REST API and curl for this). I have 6 active zones controlled by a Touch HD-12 with latest firmware. Here is an example of what I'm trying to accomplish:
1) my daily program starts, and Zone 1 is starts watering (running). This zone is set to run for 30 minutes.
2) after 10 minutes, my home automation system detects that my clothes washing machine has started. At this point, I would like to pause the currently running zone 1 until the washer is done (about 30 minutes) and then resume watering when it's done (and then kick off the rest of the programmed zones as per a normal watering cycle).
What would be the best API command to accomplish this pause? Would setting and then unsetting a restriction work? Or snoozing? (I don't see a way to snooze the watering via the API).
Thanks in advance
-
Official comment
The correct syntax would be:
curl -k --request POST --data '{"rainDelay": 1}' https://192.168.12.131:8080/api/4/restrictions/raindelay?access_token=....
This will set Rain Delay/Snooze for 1 day.
The Rain Delay(Snooze) can also be set more precise:
curl -k --request POST --data '{"rainDelayStartTime": 1489494018, "rainDelayDuration": 86400}' https://192.168.12.131:8080/api/4/restrictions/global?access_token=....
where rainDelayStartTime is the start time as unix timestamp ( see www.unixtimestamp.com)
and
rainDelayDuration is in seconds
Comment actions -
I think I can accomplish a pause by setting a rain delay using the /restrictions/raindelay POST method, but I'm not able to figure out the correct syntax to pass the parameter for the number of days. Also, I'm assuming I can set the # days to 0 to cancel the rain delay (is this correct)?
Here is the curl command I am trying, can someone please help identify where I'm going wrong? I'm getting HTTP 400 Bad Request error.
Thanks in advance
curl -m 10 -k --include -d "{\"raindelay\":1}" https://192.168.0.20:8080/api/4/restrictions/raindelay?access_token=etc.
-
I ran a GET command for raindelay and based on that output I updated my curl command to the following. I'm still getting HTTP 400 error, so my parameters are not correct. Any advice would be appreciated. Thanks
curl -m 10 -k --include -d "{\"delayCounter\":1}" https://192.168.0.20:8080/api/4/restrictions/raindelay?access_token=etc.
-
Thanks Nicholas,
I was tired of having a conversation with myself and gave up on this :-) However, since you responded - is this the correct approach to my problem (posed in my first post)? Would you recommend another way?
Also - based on my reading - the HD-12 doesn't even support rain sensors, so would this approach work?
-
Hi,
For HD12/16 we're adding rainsensor support. Actually it's already on available beta version and you can read about connecting it here: https://support.rainmachine.com/hc/en-us/articles/227832747-Rain-Sensor
Snooze (which was initially called Rain Delay) it's software and doesn't require a rain sensor but it will just remove everything from watering queue. The only restriction that reschedules the watering queue is the hourly restriction (meaning it moves the zones after the restriction finishes).
To create a hourly restriction you need to POST /api/4/restrictions/hourly with the body :
{
start: 360 //<4AM day start minute (hour * 60)>
duration: 60 //<in minutes>
weekdays: "1111111" // 1 enabled for this week day (MTWTFSS)
}
Please sign in to leave a comment.
Comments
6 comments