Multiple Sprinkler Device Manager

Posted on
Fri Dec 16, 2011 5:03 pm
berkinet offline
User avatar
Posts: 3509
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Multiple Sprinkler Device Manager

The Master Irrigation plugin is now available in the User Contributions Library.

The Master Irrigation plugin allows you to create virtual Indigo devices that correspond to real irrigation zones connected to an INSTEON or X10 sprinkler controller. The advantages of the plugin are that the multiple controllers can be collectively managed to allow an unlimited number of zones. Also, each zone can be scheduled independently of all other zones allowing you more precise control over your irrigation.
Each time the irrigation schedule is started, it first creates a schedule. The plugin checks each virtual Irrigation device to see if it is scheduled to run, and if so, its irrigation time (possibly adjusted by an Indigo multiplier variable) is added to the schedule. The plugin then starts the schedule running each zone in turn until all zones have run for their scheduled time. While you control the time the schedule starts, you cannot control the order in which the zones are watered or the time the schedule ends. That is all done automatically by the plugin.

The plugin provides complete locking so that regardless of the number of actual controllers, no two zones can be active at one time.

Before installing the Master Irrigation plugin, you should have already installed your irrigation controller hardware and set up maximum zone durations, and optionally pump control. You may wish to name the zones, but that is not required and those names will not be used by the Master Irrigation plugin.

Last edited by berkinet on Mon Dec 19, 2011 1:21 pm, edited 1 time in total.

Posted on
Thu Mar 15, 2012 11:47 am
berkinet offline
User avatar
Posts: 3509
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Managing rainfall

There was an earlier discussion regarding managing rainfall for irrigation control. For those that are interested, here is how I am doing that.

I start with an estimate of how much rainfall is required to meet my daily irrigation needs. In other words, if it rained at least x inches/mm every day I would never water. This should be roughly the same amount of water your irrigation system delivers per week divided by 7. For my yard that was 0.33 inches.

Then, I took a guess at the maximum amount of rainfall that was useful. In other words, what would really soak into the ground and not runoff. For my area that was 3 inches. Anything above that will either run off, or evaporate before it can be used.

The rest is just a few scripts for data collection and calculation.
First, I created 8 Indigo variables:
    irrRainPrevDay - Rainfall for the previous day, (00:00 - 23:59) measured at midnight
    irrRainPrevDayAM - Rainfall for the previous day between 00:00 and 06:00 (when I water)
    irr24HourRain - Rainfall for the 24 hour period immediately preceding the watering time (06:00 - 06:00)
    irrRainResevoir - An estimate of residual water available to my yard.
    irrDailyReq - The amount of water (rainfall) required per day for normal irrigation
    irrRainForecastPCT - The chance of rain (%) taken from the Weather Underground forecast
    Irrigation - A boolean (true or false) flag that controls the irrigation system
    HaltedSprinklersDate - A timestamp set each time irrigation changes from true to false

Then, each night at 23:59 I take the rainfall for the day and save it to irrRainPrevDay using this embedded AppleScript:
Code: Select all
set the value of variable "irrRainPrevDay" to the (value of variable "Wunderground_Precip_today_in")
I use the Weather Underground, but you can change the source variable to whatever you use.

Next, at 06:00, just before my daily irrigation schedule runs, I first get the Wunderground forecast:
Code: Select all
-- Change curlArgs to contain your location
set filePath to "/var/tmp/RainForecast"
set curlArgs to "-m 45 >" & filePath

-- Now, get the raw html with curl…
do shell script "/usr/bin/curl " & curlArgs

-- … and parse it for the rain forecast
set rainPct to do shell script "/usr/bin/grep -A5 -m1 fctDayConditions " & filePath & "|/usr/bin/tail -1|/usr/bin/cut -d\\> -f2|/usr/bin/cut -d% -f1"

tell application "IndigoServer"
   set the value of variable "irrRainForecastPCT" to rainPct
   log "Set rain forecast % to: " & rainPct using type "Rain-Forecast"
end tell

And then run the following AppleScript. It calculates the rainfall for the previous 24 hours (irrRainPrevDay - irrRainPrevDayAM + current day rainfall), updates the variables, and finally, determines, based on the forecast as previous rainfall, if we should water, or not.:
Code: Select all
-- This script should run just before your daily irrigation schedule starts

set quantum to 0.01 -- for rounding to 2 decimal places
set timestamp to the (current date) as text

-- Get soma data from Indigo
-- average inches of rain required per day
tell application "IndigoServer"
   -- How much water, in inches, do we use as a norm daily
   set irrDailyReq to the value of variable "irrDailyReq" as real
   -- Did we water yesterday?
   set lastIrrigation to the value of variable "Irrigation" as boolean
   -- The forecast for today
   set rainForecastPCT to the value of variable "irrRainForecastPCT"
   -- Rainfall management
   -- - what's in the resevoir?
   set irrRainResevoir to the value of variable "irrRainResevoir"
   -- - has it rained since midnight?
   set precipToday to the value of variable "Wunderground_Precip_today_in"
   -- - how much rain had fallen since midnite at this time yesterday?
   set irrRainPrevDayAM to the value of variable "irrRainPrevDayAM"
   -- - how much rain did we get yeaterday?
   --  - This was saved just before midnite yesterday.
   set irrRainPrevDay to the value of variable "irrRainPrevDay"
   -- save rainfall since midnite for use tomorrow
   set the value of variable "irrRainPrevDayAM" to precipToday
   -- calculate rainfall since this time yesterday
   set irr24HourRain to irrRainPrevDay - irrRainPrevDayAM + precipToday
   -- but don't let it go negative
   if irr24HourRain < 0 then
      set irr24HourRain to 0
   end if
   -- and save it
   set the value of variable "irr24HourRain" to irr24HourRain as text
   -- Now, manage the rain resevoir
   set irrRainResevoir to irrRainResevoir + irr24HourRain - irrDailyReq
   -- but don't let it go negative
   if irrRainResevoir < 0 then
      set irrRainResevoir to 0
   end if
   -- or get too big - can't save rain forever. 4 days at most
   if irrRainResevoir > irrDailyReq * 5 then
      set irrRainResevoir to irrDailyReq * 5
   end if
   -- and save it
   set the value of variable "irrRainResevoir" to irrRainResevoir
   -- And, at last, figure out if we should water today
   if irrRainResevoir > irrDailyReq or rainForecastPCT > 80 then
      -- Tell Indigo not to water.
      set the value of variable "Irrigation" to false
      -- If we have been watering up to yesterday, note that we shut the system off today
      if lastIrrigation then
         set the value of variable "HaltedSprinklersDate" to timestamp
      end if
      set the value of variable "Irrigation" to true
   end if
end tell

That's it. This has been a pretty dry year where I live, so there hasn't been much to calculate. But, this week has been quite wet and everything is operating as expected.

Please post any questions, ideas, or your own process for handling rainfall as part of your irrigation planning.

Posted on
Thu Mar 15, 2012 2:23 pm
berkinet offline
User avatar
Posts: 3509
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Master Irrigation Discussions moved

Previous user discussions from this announcement topic have been moved to the Master Sprinkler Device Plugin topic.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest