Announcement

Collapse
No announcement yet.

Need help on how to setup annual event to turn on holiday lights - Solved!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need help on how to setup annual event to turn on holiday lights - Solved!

    I thought I got the logic down. Seemed simple enough. Set trigger for after sunset. Set condition to be after 11/22 (any year) and set another condition to be before 1/4 (any year). But my Holiday lights aren't getting triggered to turn on or my other off event isn't turning them off. Please see attached screenshot.

    Any help would be greatly appreciated.

    Thanks!
    Attached Files

    #2
    Your conditions will never allow the event to run. There is no date on a calendar that is after 11/22 AND before 1/4.

    IF the time is 15 mins after Sunset
    AND IF the date is after 11/22/Y
    OR IF the time is 15 mins after Sunset
    AND IF the date is before 1/4/Y
    Then Turns Lights On

    Similar for Off.
    "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

    Comment


      #3
      From this post:

      A date begins at 12:00:01 AM and ends at 11:59:59 PM. The condition "The date is before" is true until 12:00:00 AM on that date, similarly "The Date is After" is true after midnight on that date. There is a tremendous amount of flexibility in these conditions, but first we should cover one nuance similar to time events. HomeSeer assumes the year begins and ends at midnight on December 31, when you are choosing "Any Year" and when you choose “The date is before” you need to understand that the year begins at 12:00AM on January 1 making the statement “The date is before March 1” really means the date is after December 31 but before March 1. Similarly “The date is after October 31” assumes it is before January 1. The Y placeholder always assumes the current year, never next year or last year.
      HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

      Comment


        #4
        Click image for larger version

Name:	xmas lights.jpg
Views:	203
Size:	83.9 KB
ID:	1510139 It's a long standing bug on how Y is evaluated as said above.

        I simply use this, even though it means that it won't run on the 1st of January. 4 days is not a killer for me.

        Comment


          #5
          Thanks for the help guys! Definitely, good info to know. I'm gonna try @kenm's logic and see how that goes if not I'll go for the simpler start date only. I'll report back my results.

          Happy Thanksgiving! :-)

          Comment


            #6
            Originally posted by George View Post
            Click image for larger version  Name:	xmas lights.jpg Views:	0 Size:	83.9 KB ID:	1510139 It's a long standing bug on how Y is evaluated as said above.

            I simply use this, even though it means that it won't run on the 1st of January. 4 days is not a killer for me.
            Personally, I don’t consider it a bug, “Y” is the current year and is evaluated at the time the event is run. Similarly time is relative to the current day, which changes at midnight. Before 1/4/Y has already passed this year, just as before 1:00AM has already occurred today (it’s 5:34PM as I write this). Adding a second trigger with an additional Condition is very easy. If you use an Easy Trigger schedule, you can easily transition midnight as Spud put in the logic to consider the time block into the next day. Even Easy Trigger has an inability to transition from Sunday at midnight into Monday. This is a .net limitation IIRC.
            HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

            Comment


              #7
              Just for info. I'm trying something different this year. Using my DaysTill script (which counts down in days to a date), I just use a device value range in an event. This goes across December/January without issue.

              So in your example, if you choose 4th January as the days till date, the device value would count down each day until it reached 0 on the 4th Jan. Therefore you just use a device range trigger between 0 and 44 in your event (44 being the number of days between Nov 22 and Jan 4).
              Jon

              Comment


                #8
                Originally posted by begunfx View Post
                Thanks for the help guys! Definitely, good info to know. I'm gonna try @kenm's logic and see how that goes if not I'll go for the simpler start date only. I'll report back my results.

                Happy Thanksgiving! :-)
                His logic will work fine.

                HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                Comment


                  #9
                  Originally posted by randy View Post
                  His logic will work fine.
                  Confirmed! It worked. Thanks guys!

                  Comment


                    #10
                    Originally posted by randy View Post
                    Personally, I don’t consider it a bug, “Y” is the current year and is evaluated at the time the event is run. Similarly time is relative to the current day, which changes at midnight. Before 1/4/Y has already passed this year, just as before 1:00AM has already occurred today (it’s 5:34PM as I write this). Adding a second trigger with an additional Condition is very easy. If you use an Easy Trigger schedule, you can easily transition midnight as Spud put in the logic to consider the time block into the next day. Even Easy Trigger has an inability to transition from Sunday at midnight into Monday. This is a .net limitation IIRC.
                    I agree and not a hard workaround, but the doc and even the event setup dropdown specifies that Y means Any Year. So in that case if a Y is in that field the expression should be evaluated just by month/date and the order that you put AND's in would work just fine. After 11/15 - Before 1/5 should evaluate to yes as both are true if the date is after the 15th. So if the selection box says 'Any Year' it should be Any Year wouldn't you think so?

                    Comment


                      #11
                      I use a seasonal virtual device to distinguish holiday time frames. It includes birthdays, anniversaries, holidays, etc. It takes a bit to set up the events to set the device, but then other events reference that device vs times / dates. I only need to set the date/Y that the switch changes, and not a before/after date. Works very well.

                      Comment


                        #12
                        Originally posted by George View Post

                        I agree and not a hard workaround, but the doc and even the event setup dropdown specifies that Y means Any Year. So in that case if a Y is in that field the expression should be evaluated just by month/date and the order that you put AND's in would work just fine. After 11/15 - Before 1/5 should evaluate to yes as both are true if the date is after the 15th. So if the selection box says 'Any Year' it should be Any Year wouldn't you think so?
                        I too got very confused by the "Y" and its meaning. I think the part I struggled most with was the fact that "Y" was actually the current year for the conditions of a given event.

                        Take Y = 2021 as an example. After 11/15/2021 AND Before 1/5/2021 can never evaluate as TRUE

                        Now take this code:

                        IF the time is 15 mins after Sunset
                        AND IF the date is after 11/22/2021
                        OR IF the time is 15 mins after Sunset
                        AND IF the date is before 1/4/2021
                        Then Turns Lights On

                        The first expression will evaluate to TRUE up until January 1st, 2022. After that it becomes:

                        IF the time is 15 mins after Sunset
                        AND IF the date is after 11/22/2022
                        OR IF the time is 15 mins after Sunset
                        AND IF the date is before 1/4/2022
                        Then Turns Lights On

                        At which point, the second expression will evaluate to TRUE.

                        I also found the AND IF and the OR IF meaning to be somewhat confusing at first.
                        "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

                        Comment


                          #13
                          Originally posted by Kevb View Post
                          I use a seasonal virtual device to distinguish holiday time frames. It includes birthdays, anniversaries, holidays, etc. It takes a bit to set up the events to set the device, but then other events reference that device vs times / dates. I only need to set the date/Y that the switch changes, and not a before/after date. Works very well.
                          Kevb I like this a lot. I think you mentioned this in another thread a while back and that's when I started using it. I have many events that use these seasonal virtual devices in a condition.

                          Event 1: (triggers at 12:01AM on 12/1 every year)
                          If the time is 12:01AM
                          AND IF date is 12/1/Y
                          THEN set Christmas equal to 1

                          Event 2:
                          If Time is 15 mins after Sunset
                          AND IF "Christmas" is equal to 1
                          THEN Turn Christmas Lights On

                          Event 3: (triggers at 12:01AM on 1/5 every year)
                          If the time is 12:01AM
                          AND IF date is 1/5/Y
                          THEN set Christmas equal to 0

                          These events just magically work all year round with no maintenance.
                          "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

                          Comment


                            #14
                            Originally posted by kenm View Post

                            Kevb I like this a lot. I think you mentioned this in another thread a while back and that's when I started using it. I have many events that use these seasonal virtual devices in a condition.

                            Event 1: (triggers at 12:01AM on 12/1 every year)
                            If the time is 12:01AM
                            AND IF date is 12/1/Y
                            THEN set Christmas equal to 1

                            Event 2:
                            If Time is 15 mins after Sunset
                            AND IF "Christmas" is equal to 1
                            THEN Turn Christmas Lights On

                            Event 3: (triggers at 12:01AM on 1/5 every year)
                            If the time is 12:01AM
                            AND IF date is 1/5/Y
                            THEN set Christmas equal to 0

                            These events just magically work all year round with no maintenance.
                            An annoying question: Is the time trigger actually necessary? Will it not trigger the moment the date becomes 12/1 or 1/5? ...or is DATE a condition-only variable and not a trigger?


                            Jim Speiser
                            38-year veteran of Home Automation
                            Still don't know squat

                            Comment


                              #15
                              Date is only a condition. Time is necessary as a trigger. You could use a recurring trigger as long as you use the target virtual device as a condition. I usually set my daily virtual devices with a time trigger of 12:01AM.
                              HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                              Comment

                              Working...
                              X