Home Automation EZine
Volume 3 Issue 4
August 1998

Features
HEADLINES
To Cable or Not?
Uncle Phil Part X
The Fourth Utility
What to wire for?
Powerline Comm
Wired for the Future
Obsolete Home?
$50 PC Remote
Positive message?
HomeVision Holidays
Powerline Modem
SmartBox

Interviews
AMP
CommScope
IES
Leviton Telcom
Lucent HomeStar
RCS
Siemon
USTec

Home Automation Products & Services

Columns
EDITORIAL
Dave Rye on X-10
What We Need Is ...
Event Calendar

Reviews
HomeTool Pro
House/2  Shareware

EZHome

Current Issue
EZine Archive

Return to Main Menu

 

HTINews Article
- Aug98 -
[HTI Home Page]
DIY Marketing Program
Promote Your Products and Services
[Click Message To Learn More]

Determining Holidays with HomeVision

"This article explains how to set up HomeVision to determine when it’s a holiday. Knowing this, it’s 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
President
Custom Solutions, Inc.
csi@csi3.com
www.csi3.com


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 it’s a holiday. Knowing this, it’s 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, it’s 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.

Date_1.gif (8956 bytes)

This is how it would appear in your schedule:

If
    Date is: (Date = 1) (Month = January)

Then
    ; Do whatever you want to on New Year’s 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:

  1. 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.
  2. 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)

Date_2.gif (9147 bytes)

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

Once you know whether it’s a holiday, it’s easy to act accordingly. Simply use the If-Then statements described above, and put the desired actions in either the "Then" or "Else" sections, like this:

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 you’re interested in. If today is a holiday, set a flag named "It’s a Holiday!". If today is not a holiday, clear the flag. Then, anywhere in your schedule you need to know if it’s a holiday, check this flag. You might also want to have specific flags like "It’s a School Day", "It’s a Work Day", etc.

With these tricks, HomeVision can determine any holiday and act accordingly!