| HTINews Article - Aug98 - [HTI Home Page] |
DIY Marketing Program Promote Your Products and Services [Click Message To Learn More] |
| "This article
explains how to set up HomeVision to determine when its a holiday. Knowing this,
its simple for HomeVision to adjust its behavior accordingly. Although this article
focuses on HomeVision, the same concepts will work with many other automation
systems." Craig Chadwick |
Introduction
Many users program their home automation system to perform different tasks on different days of the week. For example, it may turn off lights at 11:30 PM on Sunday through Thursday, but wait until 1:00 AM on Friday and Saturday nights. The ability to perform specific actions for specific days is an important feature, as almost no one lives the exact same way every day.
A common problem that arises when setting up such an automation system is how to handle exceptions to the normal weekly pattern. On holidays, for example, the homeowner may be at home instead of work, or children may not be in school. This article explains how to set up HomeVision to determine when its a holiday. Knowing this, its simple for HomeVision to adjust its behavior accordingly. Although this article focuses on HomeVision, the same concepts will work with many other automation systems.
Determining Holidays
First, if the holiday is on the same date each year, its easy to do. Simply use a "Date" condition in an If-Then statement. In the date condition, specify the month and date of the month. For example, to know if it's New Year's Day, check the boxes for the month "January" and the date "1", as shown below. This condition will only be true when the date is the first and the month is January.

If
Date is: (Date = 1) (Month = January)
Then
; Do whatever you want to on New Years Day
Else
; Do whatever you want to on other days
End If
Here are some of the holidays:
| New Year's Day : January 1 | St. Patrick's Day : March 17 |
| Groundhog Day : February 2 | Flag Day : June 14 |
| Lincoln's Birthday : February 12 | Halloween : October 31 |
| Valentine's Day : February 14 | Veteran's Day : November 11 |
| Washington's Birthday : February 22 | Christmas Day : December 25 |
What if the date moves around? For example, Labor Day is the first Monday in September, and will occur on a different date each year. Here's how to handle this:
- Determine the range of dates it could fall on. In this case, the first Monday of a month always falls between the first and seventh day of the month.
- Enter a date condition with the following items selected (as shown in the figure below):
- All seven of the allowed dates (in this example, that's 1, 2, 3, 4, 5, 6, and 7).
- The day of the week (Monday)
- The month (September)

This condition will only be true on a Monday in September where the date is the first through the seventh. Since this is the definition of Labor Day, it will be true every Labor Day, but never on any other day. This is how it would appear in your HomeVision schedule:
If
Date is: (Day = Monday) (Dates = 1,2,3,4,5,6,7) (Month = September)
Then
; Do whatever you want to on Labor Day
Else
; Do whatever you want to on other days
End If
This same method can be used for other holidays. The key is determining what dates of the month the holiday can fall on. The following table shows some holidays that move around each year:
HOLIDAY |
WHEN IT OCCURS | POSSIBLE DATES |
M. L. King Birthday |
3rd Monday in January |
15-21 |
President's Day |
3rd Monday in February |
15-21 |
Mother's Day |
2nd Sunday in May |
8-14 |
Memorial Day |
Last Monday in May |
25-31 |
Father's Day |
3rd Sunday in June |
15-21 |
Labor Day |
1st Monday in September |
1-7 |
Thanksgiving (Canada) |
2nd Monday in October |
8-14 |
Columbus Day |
2nd Monday in October |
8-14 |
Election Day |
Tuesday after 1st Monday in Nov. |
2-8 |
Thanksgiving (U.S) |
4th Thursday in November |
22-28 |
Why isn't Easter listed? Well, Easter occurs on the first Sunday after a full moon on or after March 21. It can fall anywhere from March 22 to April 25. The only way to handle this is to get a calendar for the next several years and look up the dates. Then, enter separate If-Then statements for the actual date each year. To check the year, put the current year (its last two digits) into a variable, then check the value of the variable. For example, in 1998, Easter occurs on April 12. Here's how to enter the condition:
Var #1 (Year) = current year
If
Var #1 (Year) = 98
And Date is: (Date = 12) (Month = April)
Then
; Do whatever you want to on Easter Sunday
Else
; Do whatever you want to on other days
End If
Adjusting Your Schedule
If
Date is: (Date = 1) (Month = January)
Date is: (Date = 25) (Month = December)
Date is: (Date = 4) (Month = July)
Then
; Do whatever you want to on these holidays
Else
; Do whatever you want to on other days
End If
It would be quite time consuming if you had to have separate If-Then statements like this for each holiday and for each action in your schedule. To simplify it, create a single scheduled event that runs each day at midnight (the start of a new day). Put in it the If-Then statements to check for all of the holidays youre interested in. If today is a holiday, set a flag named "Its a Holiday!". If today is not a holiday, clear the flag. Then, anywhere in your schedule you need to know if its a holiday, check this flag. You might also want to have specific flags like "Its a School Day", "Its a Work Day", etc.
With these tricks, HomeVision can determine any holiday and act accordingly!
© 1996 - 2008, Home Toys Inc. - All Rights Reserved
Powered by LJB Management Inc.