Difference between revisions of "ISY-99i Generic Calendar Using Programs and Variables"

From Universal Devices, Inc. Wiki
Jump to: navigation, search
Line 53: Line 53:
 
     Then
 
     Then
 
         Run Program 'Day of Month Advance' (If)
 
         Run Program 'Day of Month Advance' (If)
 +
 +
    Else
 +
      - No Actions - (To add one, press 'Action')
 +
 +
 +
  
 
Day of Month Advance:
 
Day of Month Advance:
  
If
+
  If
 
         (
 
         (
 
             $iDay.of.Month < 31
 
             $iDay.of.Month < 31
Line 89: Line 95:
 
         )
 
         )
 
   
 
   
Then
+
  Then
 
         $iDay.of.Month += 1
 
         $iDay.of.Month += 1
 
         $iDay.of.Month Init To $iDay.of.Month
 
         $iDay.of.Month Init To $iDay.of.Month
Line 102: Line 108:
 
         Run Program 'Holiday reset' (Then Path)
 
         Run Program 'Holiday reset' (Then Path)
 
   
 
   
Else
+
  Else
 
         $iDay.of.Month  = 1
 
         $iDay.of.Month  = 1
 
         $iDay.of.Month Init To 1
 
         $iDay.of.Month Init To 1
Line 117: Line 123:
  
 
   
 
   
Else
 
- No Actions - (To add one, press 'Action')
 
 
 
 
Odd Even Day
 
Odd Even Day
  
If
+
  If
 
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
   
 
   
Then
+
  Then
 
         $iOdd.Even.Day  = $iDay.of.Month
 
         $iOdd.Even.Day  = $iDay.of.Month
 
         $iOdd.Even.Day %= 2
 
         $iOdd.Even.Day %= 2
 
         $iOdd.Even.Day Init To $iOdd.Even.Day
 
         $iOdd.Even.Day Init To $iOdd.Even.Day
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
Line 137: Line 139:
 
Day of Week
 
Day of Week
  
If
+
  If
 
         $iDay.of.Week < 7
 
         $iDay.of.Week < 7
 
   
 
   
Then
+
  Then
 
         $iDay.of.Week += 1
 
         $iDay.of.Week += 1
 
         $iDay.of.Week Init To $iDay.of.Week
 
         $iDay.of.Week Init To $iDay.of.Week
Line 147: Line 149:
 
         Run Program 'Day of year Advance' (If)
 
         Run Program 'Day of year Advance' (If)
 
   
 
   
Else
+
  Else
 
         $iDay.of.Week  = 1
 
         $iDay.of.Week  = 1
 
         $iDay.of.Week Init To 1
 
         $iDay.of.Week Init To 1
Line 156: Line 158:
 
Day of Year Advance
 
Day of Year Advance
  
If
+
  If
 
         (
 
         (
 
             $iDay.of.Year < 365
 
             $iDay.of.Year < 365
Line 166: Line 168:
 
         )
 
         )
 
   
 
   
Then
+
  Then
 
         $iDay.of.Year += 1
 
         $iDay.of.Year += 1
 
         $iDay.of.Year Init To $iDay.of.Year
 
         $iDay.of.Year Init To $iDay.of.Year
Line 174: Line 176:
 
         Run Program 'Year' (If)
 
         Run Program 'Year' (If)
 
   
 
   
Else
+
  Else
 
         $iDay.of.Year  = 1
 
         $iDay.of.Year  = 1
 
         $iDay.of.Year Init To 1
 
         $iDay.of.Year Init To 1
Line 184: Line 186:
 
Every X Day Counter
 
Every X Day Counter
  
If
+
  If
 
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
   
 
   
Then
+
  Then
 
         $iDay.Counter += 1
 
         $iDay.Counter += 1
 
         $iEvery.Other.Day.Counter  = $iDay.Counter
 
         $iEvery.Other.Day.Counter  = $iDay.Counter
Line 198: Line 200:
 
         $iEvery.Fifth.Day.Counter %= 5
 
         $iEvery.Fifth.Day.Counter %= 5
 
         $iDay.Counter Init To $iDay.Counter
 
         $iDay.Counter Init To $iDay.Counter
         $iEvery.Other.Day.Counter Init To $iEvery.Other.Day.Counter
+
         $iEvery.Other.Day.Counter Init To $iEvery.Other.Day.Counter
 
         $iEvery.Thrid.Day.Counter Init To $iEvery.Thrid.Day.Counter
 
         $iEvery.Thrid.Day.Counter Init To $iEvery.Thrid.Day.Counter
 
         $iEvery.Fourth.Day.Counter Init To $iEvery.Fourth.Day.Counter
 
         $iEvery.Fourth.Day.Counter Init To $iEvery.Fourth.Day.Counter
 
         $iEvery.Fifth.Day.Counter Init To $iEvery.Fifth.Day.Counter
 
         $iEvery.Fifth.Day.Counter Init To $iEvery.Fifth.Day.Counter
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Christmas
 
Christmas
  
If
+
  If
 
         $iMonth is 12
 
         $iMonth is 12
 
     And $iDay.of.Month is 25
 
     And $iDay.of.Month is 25
 
   
 
   
Then
+
  Then
 
         $iHoliday  = 1
 
         $iHoliday  = 1
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
Line 221: Line 223:
 
Holiday Reset
 
Holiday Reset
  
If
+
  If
 
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
   
 
   
Then
+
  Then
 
         $iHoliday  = 0
 
         $iHoliday  = 0
 
         Run Program 'Christmas' (If)
 
         Run Program 'Christmas' (If)
Line 232: Line 234:
 
         Run Program 'Thanksgiving' (If)
 
         Run Program 'Thanksgiving' (If)
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Labor Day
 
Labor Day
  
If
+
  If
 
         $iDay.of.Week is 1
 
         $iDay.of.Week is 1
 
     And $iWeek.of.Month is 1
 
     And $iWeek.of.Month is 1
 
     And $iMonth is 9
 
     And $iMonth is 9
 
   
 
   
Then
+
  Then
 
         $iHoliday  = 1
 
         $iHoliday  = 1
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Memorial Day
 
Memorial Day
  
If
+
  If
 
         $iDay.of.Week is 1
 
         $iDay.of.Week is 1
 
     And $iMonth is 5
 
     And $iMonth is 5
Line 264: Line 266:
 
         )
 
         )
 
   
 
   
Then
+
  Then
 
         $iHoliday  = 1
 
         $iHoliday  = 1
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
New Years Day
 
New Years Day
  
If
+
  If
 
         $iDay.of.Month is 1
 
         $iDay.of.Month is 1
 
     And $iMonth is 1
 
     And $iMonth is 1
 
   
 
   
Then
+
  Then
 
         $iHoliday  = 1
 
         $iHoliday  = 1
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Thanksgiving
 
Thanksgiving
  
If
+
  If
 
         (
 
         (
 
             $iDay.of.Week is 4
 
             $iDay.of.Week is 4
Line 292: Line 294:
 
     And $iMonth is 11
 
     And $iMonth is 11
 
   
 
   
Then
+
  Then
 
         $iHoliday  = 1
 
         $iHoliday  = 1
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Leap Year Calculator
 
Leap Year Calculator
  
If
+
  If
 
         $iDay.of.Year is 1
 
         $iDay.of.Year is 1
 
     And $iYear is not 2100
 
     And $iYear is not 2100
 
   
 
   
Then
+
  Then
 
         $iLeap.Year  = $iYear
 
         $iLeap.Year  = $iYear
 
         $iLeap.Year %= 4
 
         $iLeap.Year %= 4
 
         $iLeap.Year Init To $iLeap.Year
 
         $iLeap.Year Init To $iLeap.Year
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Month Advance
 
Month Advance
  
If
+
  If
 
         $iDay.of.Month is 1
 
         $iDay.of.Month is 1
 
     And $iMonth < 12
 
     And $iMonth < 12
 
   
 
   
Then
+
  Then
 
         $iMonth += 1
 
         $iMonth += 1
 
         $iMonth Init To $iMonth
 
         $iMonth Init To $iMonth
Line 324: Line 326:
 
         $sMonth  = $iMonth
 
         $sMonth  = $iMonth
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Month Reset
 
Month Reset
  
If
+
  If
 
         $iDay.of.Month is 1
 
         $iDay.of.Month is 1
 
     And $iMonth is 12
 
     And $iMonth is 12
 
   
 
   
Then
+
  Then
 
         $iMonth  = 1
 
         $iMonth  = 1
 
         $iMonth Init To 1
 
         $iMonth Init To 1
Line 339: Line 341:
 
         $sMonth Init To 1
 
         $sMonth Init To 1
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Friday
 
Friday
  
If
+
  If
 
         On Fri
 
         On Fri
 
         Time is  1:00:00AM
 
         Time is  1:00:00AM
 
   
 
   
Then
+
  Then
 
         $iSync  = 5
 
         $iSync  = 5
 
         Run Program 'Sync email alert' (If)
 
         Run Program 'Sync email alert' (If)
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Monday
 
Monday
  
If
+
  If
 
         On Mon
 
         On Mon
 
         Time is  1:00:00AM
 
         Time is  1:00:00AM
 
   
 
   
Then
+
  Then
 
         $iSync  = 1
 
         $iSync  = 1
 
         Run Program 'Sync email alert' (If)
 
         Run Program 'Sync email alert' (If)
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Saturday
 
Saturday
  
If
+
  If
 
         On Sat
 
         On Sat
 
         Time is  1:00:00AM
 
         Time is  1:00:00AM
 
   
 
   
Then
+
  Then
 
         $iSync  = 6
 
         $iSync  = 6
 
         Run Program 'Sync email alert' (If)
 
         Run Program 'Sync email alert' (If)
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Sunday
 
Sunday
  
If
+
  If
 
         On Sun
 
         On Sun
 
         Time is  1:00:00AM
 
         Time is  1:00:00AM
 
   
 
   
Then
+
  Then
 
         $iSync  = 7
 
         $iSync  = 7
 
         Run Program 'Sync email alert' (If)
 
         Run Program 'Sync email alert' (If)
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Sync email alert
 
Sync email alert
  
If
+
  If
 
         $iSync is not $iDay.of.Week
 
         $iSync is not $iDay.of.Week
 
   
 
   
Then
+
  Then
 
         Send Notification to 'dr-apo' content 'Out of Sync'
 
         Send Notification to 'dr-apo' content 'Out of Sync'
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Thursday
 
Thursday
  
If
+
  If
 
         On Thu
 
         On Thu
 
         Time is  1:00:00AM
 
         Time is  1:00:00AM
 
   
 
   
Then
+
  Then
 
         $iSync  = 4
 
         $iSync  = 4
 
         Run Program 'Sync email alert' (If)
 
         Run Program 'Sync email alert' (If)
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Tuesday
 
Tuesday
  
If
+
  If
 
         On Tue
 
         On Tue
 
         Time is  1:00:00AM
 
         Time is  1:00:00AM
 
   
 
   
Then
+
  Then
 
         $iSync  = 2
 
         $iSync  = 2
 
         Run Program 'Sync email alert' (If)
 
         Run Program 'Sync email alert' (If)
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Wednesday
 
Wednesday
  
If
+
  If
 
         On Wed
 
         On Wed
 
         Time is  1:00:00AM
 
         Time is  1:00:00AM
 
   
 
   
Then
+
  Then
 
         $iSync  = 3
 
         $iSync  = 3
 
         Run Program 'Sync email alert' (If)
 
         Run Program 'Sync email alert' (If)
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Ever X Weeks
 
Ever X Weeks
  
If
+
  If
 
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
   
 
   
Then
+
  Then
 
         $iWeek.Counter  = $iDay.Counter
 
         $iWeek.Counter  = $iDay.Counter
 
         $iWeek.Counter /= 7
 
         $iWeek.Counter /= 7
Line 463: Line 465:
 
         $iWeek.Counter Init To $iWeek.Counter
 
         $iWeek.Counter Init To $iWeek.Counter
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Week of Month
 
Week of Month
  
If
+
  If
 
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
   
 
   
Then
+
  Then
 
         $iWeek.of.Month  = $iDay.of.Month
 
         $iWeek.of.Month  = $iDay.of.Month
 
         $iWeek.of.Month -= 1
 
         $iWeek.of.Month -= 1
Line 480: Line 482:
 
         $iWeek.of.Month Init To $iWeek.of.Month
 
         $iWeek.of.Month Init To $iWeek.of.Month
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   
 
Year
 
Year
  
If
+
  If
 
         $iDay.of.Year is 1
 
         $iDay.of.Year is 1
 
   
 
   
Then
+
  Then
 
         $iYear += 1
 
         $iYear += 1
 
         $iYear Init To $iYear
 
         $iYear Init To $iYear
Line 495: Line 497:
 
         Run Program 'Leap year calculator' (If)
 
         Run Program 'Leap year calculator' (If)
 
   
 
   
Else
+
  Else
 
   - No Actions - (To add one, press 'Action')
 
   - No Actions - (To add one, press 'Action')
 
   
 
   

Revision as of 17:26, 20 September 2011

WeatherBug Irrigation Module Settings
WeatherBug Irrigation Module Status

The Basic Idea of this Series of Programs

ISY’s date function is a bit limited. As the firmware currently supports, there is no direct way to use it for recurring events except related to day of the week. For example, you can have something happen every Monday, or every Monday and Tuesday, but you can’t set up something to run on the third Tuesday of every month, or every 3 rd day, or on even days of the month, or every July 4th, I think you get the idea.

Working outside the built-in firmware, a series of programs using the variable function can solve this problem. The following series of programs starts off with a single program that triggers at midnight and then cascades through a series of additional programs using “run if”, “run then”, and “run else” commands to update a set of variables each day at midnight to report the current day, day of month, day of year, month, year, and week of month. In addition, there are counters which follow an every other, every third, every fourth, and every fifth schedule. Also, there is a program that sets a variable according to whether it is an even day or an odd day. Finally, a series of programs sets a variable to 1 on several US holidays. Some of these programs can be expanded upon such as the holiday series or the ever x number of days or weeks programs to suit your needs.


The Variables

There are a number of variables that need to be created by the user. By convention, variables that have an “i” to start the name are integer variables and an “s” indicates a state variable.

  • iDay.of.Year starts with 1 on Jan1 and counts to 365 (or 366 on leap year). This variable is a less used variable that is mostly included for completeness as it is rare that someone needs to know what day of the year it is.
  • iDay.of.Month is how many days into the month we are (i.e. the 5th of the month).
  • iYear is simply the current year.
  • iLeap.Year counts 0,1,2,3,0,1,2,3,etc where 3 means that we are in a leap year. This is primarily a variable used to keep the other variables in check since rarely do people have cause to include this directly in a program.
  • iDay.of.Week starts with 1 on Monday and counts through to 7 on Sunday. This variable is used to cross check the status of the variables against ISY’s internal day of week function so as to alert you if it gets out of sync. You do not need this variable since ISY has this function built-in but you can choose to use it instead of the ISY’s built-in day function and get the same result.
  • iMonth is simply the current month starting with 1 for Jan.
  • iDay.Counter gets one number higher everyday without regard to the start of a new month or year. The primary purpose of this variable is to serve as a basis for the every x number of days/weeks programs since those programs require a reference that always increases by one each day. I have arbitrarily used MS Excel’s system of setting Jan 1, 1900 equal to day one and then counting from there. This offered an opportunity to test these programs well into the future and have a reference to check the values against.
  • iEver.xxx.Counter starts with 0 and counts up to x-1. For example, iEvery.Fourth.Day.Counter cycles through 0,1,2,3,0,1,2,3,etc. If today the variable was equal to 1 and you wanted to start watering your lawn tomorrow continuing every 4th day after that, set your program to water when the variable is 2.
  • iWeek.of.Month starts with 1 on the first day of the month and increases by 1 every 7 days until the next month starts. So if you wanted something to happen on the second Tuesday of each month, set it to occur on Tuesdays when iWeek.of.Month is equal to 2.
  • iWeek.Counter counts the number of weeks since Jan 1, 1900. The purpose of this variable is to calculate the every x weeks programs as there is likely no value in knowing how many weeks have passed since Jan 1, 1900. This value is produced by dividing iDay.Counter by 7.
  • i.Every.xxx.Week programs start at 0 and count to x-1. This works the same as the iEvery.xxx.Day.Counter programs except it is for weeks.
  • iOdd.Even.Day sets to 0 on even days and 1 on odd days of the month. This is useful in communities with watering restrictions limit certain addresses to water on even or odd days of the month. This differs from iEvery.Other.Day.Counter when a month with an odd number of days comes to a close.
  • iHoliday sets to 1 on the listed holidays and 0 on all other days. Feel free to add your own holidays. I use this value to shut down wake-up alarms.
  • iSync is a variable whose purpose is to test the status of this set of programs against the ISY’s internal day of week function. An email is triggered if the two are out of sync.
  • The sVariables are simply the same value of the corresponding iVariables copied over to the state variable side. The purpose of this is so that you can use them as program “triggers”. You can certainly add more to the list as you see fit. The difference between a “state” variable and an “integer” variable is discussed elsewhere in the wiki.

Setting Up The Programs

  • Setup the variables. This is not automatic. You must enter the listed variables into ISY AT THE SAME ID LOCATION AS SHOWN. ISY programs refrence the id location NUMBER, not the name. The name you enter in the name column is shown in the program for convenience only. Because I wrote these programs and then worked on some other programs, and then came back to these programs, there are some intervening variables which you need not concern yourself with, except to know that they must be skipped over until you get back to the correct ID number location. If you have already used some of the variable locations for other programs, you must either redirect you current program to another ID location or redirect the appropriate programs from these programs to new ID locations. You are free to change the names if you like so long as you understand what it represents.
  • Import the programs or undertake the task of manually entering the programs. Please observe the screen captures to see how I set up the folder architecture. You are certainly free to do it differently, but keeping the programs organized this way is helpful.
  • Set the start values. You must set the current date including day of month, day of year, month, day of week, year, and leap year (3 for a leap year, 0 for the year after a leap year, etc.) variables to the correct values. If you would like to stay true to the day counter starting with 1 on Jan 1, 1900 then you need to cross reference that number to MS Excel. This is an arbitrary decision on your part as any number would actually work. All of the other variables are calculated from those values and will settle in when the programs run at midnight. The “init” values need not be set as they will automatically populate at the midnight run time (unless you reboot your ISY prior to that time in which case all of the values will be lost). Please look elsewhere in the wiki to learn about how the “init” value works.
  • Go to the Configuration Tab, System sub tab, System box and Uncheck the box next to “Catch up Schedules at Restart”. Not doing so will cause your ISY to run these programs every time the ISY is rebooted pushing it one day into the future which in most cases will be an error. Missed schedule grace period should be left at 15 minutes.
  • Setup the email at ID location number 1 to whom you want the email to be sent and what you would like the content to be in the event that the ISY’s day of week becomes out of sync with the day of week calculated by these programs. It is assumed that if this variable is accurate, all of the others will be as well. Furthermore, it is the only thing that is possible for ISY to test on its own.


Potential Pitfalls

The primary reason for a fault is a power failure or otherwise taking the ISY offline. If the ISY is continuously not operating between 12 midnight and 12:15 am the programs will fall one day behind. To manually push the programs one day forward, right click on “Advance Day” program and click “run then”. You can do this repeatedly to advance several days forward. The ISY was tested by me to function properly through the year 2015. I did not actually run the program any further out than that but I have no reason to believe it should fail. It is designed to run correctly for several hundred years before the leap year issue no longer is accurate. I trust that will not cause you any inconvenience. At the time of this writing, these programs have been up and running real time for about 4 months without error. Based on this and my tests running these programs through to 2015 in “fake time” I suspect there are no errors. If you think you have found a bug, please let me know. Username: apostolakisl.


The Programs

Advance Day:

   If
       Time is 12:00:00AM

   Then
       Run Program 'Day of Month Advance' (If)
   Else
     -	No Actions - (To add one, press 'Action')



Day of Month Advance:

  If
       (
            $iDay.of.Month < 31
        And (
                 $iMonth is 1
              Or $iMonth is 3
              Or $iMonth is 5
              Or $iMonth is 7
              Or $iMonth is 8
              Or $iMonth is 10
              Or $iMonth is 12
            )
       )
    Or (
            $iDay.of.Month < 30
        And (
                 $iMonth is 4
              Or $iMonth is 6
              Or $iMonth is 9
              Or $iMonth is 11
            )
       )
    Or (
            $iDay.of.Month < 29
        And $iMonth is 2
        And $iLeap.Year is 0
       )
    Or (
            $iDay.of.Month < 28
        And $iMonth is 2
        And $iLeap.Year > 0
       )

  Then
       $iDay.of.Month += 1
       $iDay.of.Month Init To $iDay.of.Month
       $sDay.of.Month Init To $iDay.of.Month
       $sDay.of.Month  = $iDay.of.Month
       Run Program 'Day of Week' (If)
       Run Program 'Month Advance' (If)
       Run Program 'Month Reset' (If)
       Run Program 'Week of Month' (Then Path)
       Run Program 'Ever X Weeks' (Then Path)
       Run Program 'Odd Even Day' (Then Path)
       Run Program 'Holiday reset' (Then Path)

  Else
       $iDay.of.Month  = 1
       $iDay.of.Month Init To 1
       $sDay.of.Month Init To $iDay.of.Month
       $sDay.of.Month  = $iDay.of.Month
       Run Program 'Day of Week' (If)
       Run Program 'Month Advance' (If)
       Run Program 'Month Reset' (If)
       Run Program 'Week of Month' (Then Path)
       Run Program 'Ever X Weeks' (Then Path)
       Run Program 'Odd Even Day' (Then Path)
       Run Program 'Holiday reset' (Then Path)


Odd Even Day

  If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

  Then
       $iOdd.Even.Day  = $iDay.of.Month
       $iOdd.Even.Day %= 2
       $iOdd.Even.Day Init To $iOdd.Even.Day

  Else
  - No Actions - (To add one, press 'Action')

Day of Week

  If
       $iDay.of.Week < 7

  Then
       $iDay.of.Week += 1
       $iDay.of.Week Init To $iDay.of.Week
       $sDay.of.Week Init To $iDay.of.Week
       $sDay.of.Week  = $iDay.of.Week
       Run Program 'Day of year Advance' (If)

  Else
       $iDay.of.Week  = 1
       $iDay.of.Week Init To 1
       $sDay.of.Week Init To $iDay.of.Week
       $sDay.of.Week  = $iDay.of.Week
       Run Program 'Day of year Advance' (If)

Day of Year Advance

  If
       (
            $iDay.of.Year < 365
        And $iLeap.Year > 0
       )
    Or (
            $iDay.of.Year < 366
        And $iLeap.Year is 0
       )

  Then
       $iDay.of.Year += 1
       $iDay.of.Year Init To $iDay.of.Year
       $sDay.of.Year Init To $iDay.of.Year
       $sDay.of.Year  = $iDay.of.Year
       Run Program 'Every x Day Counter' (Then Path)
       Run Program 'Year' (If)

  Else
       $iDay.of.Year  = 1
       $iDay.of.Year Init To 1
       $sDay.of.Year  = $iDay.of.Year
       $sDay.of.Year Init To $iDay.of.Year
       Run Program 'Every x Day Counter' (Then Path)
       Run Program 'Year' (If)

Every X Day Counter

  If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

  Then
       $iDay.Counter += 1
       $iEvery.Other.Day.Counter  = $iDay.Counter
       $iEvery.Thrid.Day.Counter  = $iDay.Counter
       $iEvery.Fourth.Day.Counter  = $iDay.Counter
       $iEvery.Fifth.Day.Counter  = $iDay.Counter
       $iEvery.Other.Day.Counter %= 2
       $iEvery.Thrid.Day.Counter %= 3
       $iEvery.Fourth.Day.Counter %= 4
       $iEvery.Fifth.Day.Counter %= 5
       $iDay.Counter Init To $iDay.Counter
       $iEvery.Other.Day.Counter Init To  $iEvery.Other.Day.Counter
       $iEvery.Thrid.Day.Counter Init To $iEvery.Thrid.Day.Counter
       $iEvery.Fourth.Day.Counter Init To $iEvery.Fourth.Day.Counter
       $iEvery.Fifth.Day.Counter Init To $iEvery.Fifth.Day.Counter

  Else
  - No Actions - (To add one, press 'Action')

Christmas

  If
       $iMonth is 12
   And $iDay.of.Month is 25

  Then
       $iHoliday  = 1

  Else
  - No Actions - (To add one, press 'Action')

Holiday Reset

  If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

  Then
       $iHoliday  = 0
       Run Program 'Christmas' (If)
       Run Program 'Labor Day' (If)
       Run Program 'Memorial Day' (If)
       Run Program 'New Years Day' (If)
       Run Program 'Thanksgiving' (If)

  Else
  - No Actions - (To add one, press 'Action')

Labor Day

  If
       $iDay.of.Week is 1
   And $iWeek.of.Month is 1
   And $iMonth is 9

  Then
       $iHoliday  = 1

  Else
  - No Actions - (To add one, press 'Action')

Memorial Day

  If
       $iDay.of.Week is 1
   And $iMonth is 5
   And (
            (
                 $iWeek.of.Month is 4
             And $iDay.of.Month > 24
            )
         Or (
                 $iWeek.of.Month is 5
             And $iDay.of.Month > 24
            )
       )

  Then
       $iHoliday  = 1

  Else
  - No Actions - (To add one, press 'Action')

New Years Day

  If
       $iDay.of.Month is 1
   And $iMonth is 1

  Then
       $iHoliday  = 1

  Else
  - No Actions - (To add one, press 'Action')

Thanksgiving

  If
       (
            $iDay.of.Week is 4
         Or $iDay.of.Week is 5
       )
   And $iWeek.of.Month is 4
   And $iMonth is 11

  Then
       $iHoliday  = 1

  Else
  - No Actions - (To add one, press 'Action')

Leap Year Calculator

  If
       $iDay.of.Year is 1
   And $iYear is not 2100

  Then
       $iLeap.Year  = $iYear
       $iLeap.Year %= 4
       $iLeap.Year Init To $iLeap.Year

  Else
  - No Actions - (To add one, press 'Action')

Month Advance

  If
       $iDay.of.Month is 1
   And $iMonth < 12

  Then
       $iMonth += 1
       $iMonth Init To $iMonth
       $sMonth Init To $iMonth
       $sMonth  = $iMonth

  Else
  - No Actions - (To add one, press 'Action')

Month Reset

  If
       $iDay.of.Month is 1
   And $iMonth is 12

  Then
       $iMonth  = 1
       $iMonth Init To 1
       $sMonth  = 1
       $sMonth Init To 1

  Else
  - No Actions - (To add one, press 'Action')

Friday

  If
       On Fri
       Time is  1:00:00AM

  Then
       $iSync  = 5
       Run Program 'Sync email alert' (If)

  Else
  - No Actions - (To add one, press 'Action')

Monday

  If
       On Mon
       Time is  1:00:00AM

  Then
       $iSync  = 1
       Run Program 'Sync email alert' (If)

  Else
  - No Actions - (To add one, press 'Action')

Saturday

  If
       On Sat
       Time is  1:00:00AM

  Then
       $iSync  = 6
       Run Program 'Sync email alert' (If)

  Else
  - No Actions - (To add one, press 'Action')

Sunday

  If
       On Sun
       Time is  1:00:00AM

  Then
       $iSync  = 7
       Run Program 'Sync email alert' (If)

  Else
  - No Actions - (To add one, press 'Action')

Sync email alert

  If
       $iSync is not $iDay.of.Week

  Then
       Send Notification to 'dr-apo' content 'Out of Sync'

  Else
  - No Actions - (To add one, press 'Action')

Thursday

  If
       On Thu
       Time is  1:00:00AM

  Then
       $iSync  = 4
       Run Program 'Sync email alert' (If)

  Else
  - No Actions - (To add one, press 'Action')

Tuesday

  If
       On Tue
       Time is  1:00:00AM

  Then
       $iSync  = 2
       Run Program 'Sync email alert' (If)

  Else
  - No Actions - (To add one, press 'Action')

Wednesday

  If
       On Wed
       Time is  1:00:00AM

  Then
       $iSync  = 3
       Run Program 'Sync email alert' (If)

  Else
  - No Actions - (To add one, press 'Action')

Ever X Weeks

  If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

  Then
       $iWeek.Counter  = $iDay.Counter
       $iWeek.Counter /= 7
       $iEvery.Other.Week  = $iWeek.Counter
       $iEvery.Other.Week %= 2
       $iEvery.Thrid.Week  = $iWeek.Counter
       $iEvery.Thrid.Week %= 3
       $iEvery.Fourth.Week  = $iWeek.Counter
       $iEvery.Fourth.Week %= 4
       $iEvery.Fourth.Week Init To $iEvery.Fourth.Week
       $iEvery.Thrid.Week Init To $iEvery.Thrid.Week
       $iEvery.Other.Week Init To $iEvery.Other.Week
       $iWeek.Counter Init To $iWeek.Counter

  Else
  - No Actions - (To add one, press 'Action')

Week of Month

  If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

  Then
       $iWeek.of.Month  = $iDay.of.Month
       $iWeek.of.Month -= 1
       $iWeek.of.Month /= 7
       $iWeek.of.Month += 1
       $sWeek.of.Month  = $iWeek.of.Month
       $sWeek.of.Month Init To $iWeek.of.Month
       $iWeek.of.Month Init To $iWeek.of.Month

  Else
  - No Actions - (To add one, press 'Action')

Year

  If
       $iDay.of.Year is 1

  Then
       $iYear += 1
       $iYear Init To $iYear
       $sYear  = $iYear
       $sYear Init To $iYear
       Run Program 'Leap year calculator' (If)

  Else
  - No Actions - (To add one, press 'Action')

Initialize the Module

After you have installed the Irrigation Module the Irrigation Requirement variable will most likely display zero. You will have to trigger a reset of the module variables to get things going correctly. Below is a walk-thru of the steps to perform this reset. Please note: If its the rainy season it may be difficult to tell if Irrigation Requirement is having an issue, so its recommended this be performed anyways just after the first install of the module.

  1. In the ISY Admin Console go to the Programs tab.
  2. Create the temporary program shown in the example below.
  3. Right click on the program in the folder tree and select "Run Then" to reset the module.
  4. Go back to the Weatherbug tab.
  5. Check again Irrigation Requirement and you should now see a number instead of a zero.
  6. Once you have done this initialization process you can delete the temporary program.
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')

Then
        Irrigation - Reset Variables




Forum thread: Proposed Evapotranspiration Algorithm in 3.1.4 Beta



ISY-26 INSTEON / ISY-99i Series INSTEON : How-To Guide