Jump to content

repeating month and/or day of the month


oskrypuch

Recommended Posts

Wooohooo, I'm famous. :P

 

On a more serious note:

 

It would really be great if you guys could create a single "day counter" value that a variable could be compared to. The day counter would start at 1 (you could do like excel and use 1/1/1900) and start counting. This day number would be determined directly from the ISY clock.

 

If I had that day counter, I could do a comparison to check if the ISY programs are in sync with the ISY clock/calander and have them self correct. In other words an extended power failure or if you took it offline for a while, on reboot it would be able to catch up.

Link to comment

So I made a few more changes (I didn't post them above but could if you want me to)

 

I made only the first program run at 12:00:00 am and all of the rest of the programs cascade off of that program use the then/else clauses to run the next program in the series in the proper order.

 

Doing this allowed me to test the program. I elliminated the 12:00:00 am part of the first program (just for the test) and wrote a second program that ran the program 1543 times (just a random number). I used excel to determine todays date in number format (it is 40689), then after running the program 1543 times that came to 42232. Excel and my program agree that the date is 8/16/2015 (a Sunday).

 

So, at least that far out it works.

Link to comment
  • 1 month later...

I added a week of month to my scheme:

 

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')

 

You also need to put a "run then week of month" in the then and else section of "day of month" program.

 

For example, to get something to run on the the third Tuesday

 

If
       $iDay.of.Week is 2
   And $iWeek.of.Month is 3

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

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

Link to comment

I can export it for you and email it. PM me with your email address.

 

Be aware, however, that you will have to still set all of the variables manually. If you currently don't have any variable spots used, you will just need to go to the variable page and put the names in.

 

If you have already use variables for other programs, you will need to change my programs to point to new variables, or change your other programs to point to new variables.

 

ISY does not reference variables by name, it references them by their ID number. Whatever name you fill in for that id number, it sticks that into the program. So the program displays a name, but it is only filling in the name after it looks up the id number.

 

Also, if by odd/even you are looking for doing things every other day, that is already built in. Use the "every other day" counter. It flips back and forth at midnight 0/1. I also have an every third, every fourth, etc. They all start at 0 and go up to n-1 where n is the number of days.

 

I am also adding an every n weeks program as well.

Link to comment

Here is the every x weeks counter. It includes every other, every third, every fourth. The variables go 0,1 for every other, 0,1,2 for every third, and 0,1,2,3 for every fourth week. You can add more if you need it.

 

The variable iWeek.Counter uses iDay.Counter to calculate the number of weeks since Jan 1, 1900. Then deviding that by 2, 3, or 4 and using the remainder giver you your value.

 

Please note, you need to add a "run then" at the end of the "day of month" program then/else clause for this program to get tripped every day at MN in the proper order.

 

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')

Link to comment

For those who need an even/odd day schedule (city water restrictions appear to be the culprit), here it is.

 

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')

 

0 is for even days, 1 for odd days.

Again, need to add the "run then" in the day of month program then/else sections for this program to update.

Link to comment
  • 1 month later...

As a precaution I have written a set of programs to compare my variables to the only real value available on ISY. ISY has a day of week of "if" option so each morning at 1am I have it set a variable "isync" to the day of week according to ISY's clock. 1 is monday and sunday is 7. Then it forwards onto the test program which compares isync to idayofweek and if they are different sends an email. So far, my program has never gotten out of sync, but what the heck.

 


'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')

 



'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')

 

 

'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')


 

And each additional day of the week continues on. I won't post them all since I think you get the idea.

Link to comment

As a precaution I have written a set of programs to compare my variables to the only real value available on ISY. ISY has a day of week "if" option so each morning at 1am I have it set a variable "isync" to the day of week according to ISY's clock. 1 is monday and sunday is 7. Then it forwards onto the test program which compares isync to idayofweek and if they are different sends an email. So far, my program has never gotten out of sync, but what the heck.

 


'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')

 



'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')

 

 

'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')


 

And each additional day of the week continues on. I won't post them all since I think you get the idea.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...