Jump to content

Thanksgiving and Christmas


phatmatt

Recommended Posts

Posted (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 by phatmatt
Posted

What about

IF

X-mas lights are ON

THEN
        Set 'Livingroom / Porch Outlet' On
        Set 'Livingroom / Front Porch Lights' Off

  • Like 1
Posted

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:

image.png.b282c8613da0fbaf751c250b22b133da.png

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.....

  • Like 1
Posted
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.).

  • Thanks 1
Posted
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
 

 

  • Like 3
  • Thanks 1
Posted
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).

  • Like 1
  • Thanks 1
Posted
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.

  • Thanks 1
Posted
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.

  • Thanks 1
Posted
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.

  • Like 1
  • Thanks 1
Posted
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

  • Like 1
Guest
This topic is now closed to further replies.

×
×
  • Create New...