phatmatt Posted December 9, 2020 Posted December 9, 2020 (edited) I am trying to turn off my front porch lights when the the Thanksgiving or Christmas decorations are setup outside. I can do it for the current month or next year or add a new if for a bunch of years in the future (which is what I have now) but it seems to me that I should be able to just put "if its Nov or Dec then turn off porch lights" regardless of year. What am I missing, or is this just the way it is? Weekend Christmas test - [ID 000D][Parent 0001] If On Never From 7:30:00AM on 2020/12/10 To 12:30:00AM on 2020/12/27 Or On Never From 7:30:00AM on 2020/11/15 To 12:30:00AM on 2020/11/29 Or On Never From 7:30:00AM on 2020/10/18 To 12:30:00AM on 2020/10/31 And From 9:00:00AM To 10:45:00PM (same day) Then Set 'Livingroom / Porch Outlet' On Set 'Livingroom / Front Porch Lights' Off Else Set 'Livingroom / Porch Outlet' Off Edited December 9, 2020 by phatmatt
asbril Posted December 9, 2020 Posted December 9, 2020 What about IF X-mas lights are ON THEN Set 'Livingroom / Porch Outlet' On Set 'Livingroom / Front Porch Lights' Off 1
MrBill Posted December 9, 2020 Posted December 9, 2020 If you're on version 4.x I don't believe the functionality exists directly, however there were some programs to keep track of the date written by users. On version 5.x you can Uncheck the "Daily" box, and it will add a date range to the screen: Unfortunately this requires specific dates, which means the date ranges will need to be updated periodically. Using the straight forward method you would schedule the porch light to turn on Jan 1 to Oct31. Another option is to use the GoogleHoliday's nodeserver to read a google calendar. The downside is that you wouldn't be able to use the nodeserver for real holidays. See also this thread: and specifically this post on Oct 11 of this year: which doesn't quite work, but the next post has a suggestion for fixing..... 1
gzahar Posted December 12, 2020 Posted December 12, 2020 On 12/9/2020 at 10:04 AM, MrBill said: Another option is to use the GoogleHoliday's nodeserver to read a google calendar. The downside is that you wouldn't be able to use the nodeserver for real holidays GoogleHoliday's nodeserver allows you to read from multiple google calendars, so it would not preclude you from using it for real holidays also. But if you can use nodeservers, there is a Timedata nodeserver that can run either on PGC or locally that would allow you to generate constraints based on just the month (and/or day of the month, etc.). 1
kclenden Posted December 12, 2020 Posted December 12, 2020 On 12/9/2020 at 10:39 AM, phatmatt said: What am I missing, or is this just the way it is? If your ISY firmware is version 5.x, you can create your own date variables. Here is a program that runs a midnight on my ISY Set Date Variables - [ID 00A0][Parent 004D] If Time is 12:00:00AM Then // Determine Day of Week $sISY.DayOfWeek = [Current Day of Week] $sISY.DayOfWeek Init To $sISY.DayOfWeek $iISY.DayOfWeek = $sISY.DayOfWeek // Determine Day of Month $sISY.DayOfMonth = [Current Day of Month] $sISY.DayOfMonth Init To $sISY.DayOfMonth $iISY.DayOfMonth = $sISY.DayOfMonth // Determine Month Of Year $sISY.MonthOfYear = [Current Month (Jan=1, Feb=2, etc.)] $sISY.MonthOfYear Init To $sISY.MonthOfYear $iISY.MonthOfYear = $sISY.MonthOfYear // Determine Week of Month $iISY.WeekOfMonth = $sISY.DayOfMonth $iISY.WeekOfMonth -= 1 $iISY.WeekOfMonth /= 7 $iISY.WeekOfMonth += 1 $iISY.WeekOfMonth Init To $iISY.WeekOfMonth $sISY.WeekOfMonth = $iISY.WeekOfMonth $sISY.WeekOfMonth Init To $iISY.WeekOfMonth // Create Month.Day Combo $iISY.Date_Scratchpad = [Current Day of Month] $iISY.Date_Scratchpad /= 100 $iISY.Date_Scratchpad += [Current Month (Jan=1, Feb=2, etc.)] $sISY.MMDD = $iISY.Date_Scratchpad $sISY.MMDD Init To $sISY.MMDD $iISY.MMDD = $sISY.MMDD Else - No Actions - (To add one, press 'Action') Now I can use $sISY.MMDD for date ranges that don't include the year. So for example to set a variable that I use to enable programs that should run during the Christmas season, I use this program. Christmas Season - [ID 00A7][Parent 0036] If $sISY.MMDD >= 12.01 Or $sISY.MMDD <= 1.1 Then $sChristmasSeason = $cTrue Else $sChristmasSeason = $cFalse 3 1
MrBill Posted December 12, 2020 Posted December 12, 2020 @kclenden This is great! Question, why are these created as a state variable then converted to integer variables? Is there a need for both?
gzahar Posted December 12, 2020 Posted December 12, 2020 1 hour ago, MrBill said: @kclenden This is great! Question, why are these created as a state variable then converted to integer variables? Is there a need for both? Probably depends on how you want to use them (trigger a program by date changing or not). 1 1
MrBill Posted December 12, 2020 Posted December 12, 2020 1 minute ago, gzahar said: Probably depends on how you want to use them (trigger a program by date changing or not). True, but I'm asking about the duplication. My small brain only see's a need for them to be either/or but not both. This is one of those things that I have no need for at this point but i'm going to add the variables and program anyway so that when I have the need I won't have to hunt. I just want to know the advantage of creating them as two complete sets of variables. 1
gzahar Posted December 12, 2020 Posted December 12, 2020 2 minutes ago, MrBill said: True, but I'm asking about the duplication. My small brain only see's a need for them to be either/or but not both. This is one of those things that I have no need for at this point but i'm going to add the variables and program anyway so that when I have the need I won't have to hunt. I just want to know the advantage of creating them as two complete sets of variables. You may have a need for both type of programs. One where you want it to trigger/run when the date changes (at midnight) and another that you don't want to trigger when the date changes (triggered by hour or some other criteria, but runs 'then' only when it is a certain date). Again, it depends on what you are trying to do with the programs. 1
gzahar Posted December 12, 2020 Posted December 12, 2020 Also note that you will need to set the precision of the xISY.MMDD & scratchpad variables to 2. 2
kclenden Posted December 13, 2020 Posted December 13, 2020 9 hours ago, MrBill said: Question, why are these created as a state variable then converted to integer variables? Is there a need for both? @gzahar is spot on. Sometimes I want to be able to compare to a date variable, but I don't want a change in that date variable to trigger an evaluation of the IF. The really creative part of the code that gives you a month.day combo came from code that @larryllix shared a while back. 1 1
larryllix Posted December 13, 2020 Posted December 13, 2020 12 hours ago, MrBill said: True, but I'm asking about the duplication. My small brain only see's a need for them to be either/or but not both. This is one of those things that I have no need for at this point but i'm going to add the variables and program anyway so that when I have the need I won't have to hunt. I just want to know the advantage of creating them as two complete sets of variables. A state variable is needed to trigger date based programs. If a trigger is not wanted, then disable the program trigger, or use triggers in an initiating program that calls a second (disabled) program, containing the date filters. The calculations cannot be done using the same state variables, as that would trigger programs to evaluate every time an intermediate value was placed in the state variable. ** NOTE: One thing I wanted to mention in the sample program posted above : When you create a range test that involves over the end of the year, you must use OR logic whereas for a date range not spanning the end of the year use must use AND logic. eg: > Dec 15 OR < Jan 15 > Dec 15 AND < Dec 31 1
MrBill Posted December 13, 2020 Posted December 13, 2020 Thanks All, I can now see the point of having each as both integer and state.
Recommended Posts