All of us crave it, but only a select few of us obtain it. I'm referring to acceptance of our home automation hobby by our spouses, of course—the elusive SAF . We can wax quite eloquently of the benefits of computer-controlled lighting , talking CID , driveway vehicle detectors , and automated sprinklers . But seldom do we get more than a glazed look in return. Well, here's a simple hack that will add a touch of class to your home, and might get a smile from your better half.
All you need is a computer in a room where it can be heard easily (or, ideally, a whole-house audio system) and some quality chime recordings. In fact, the hardest part is finding a quality recording of the chimes—you'll need each hour's chime in a separate sound file. A search at the HomeSeer message board (http://ubb.HomeSeer.com/) will turn up many to choose from, or visit the Smart Home Hacks web site (http://www.oreilly.com/catalog/smarthomehks) for pointers to appropriate files.
Hacking the Hack
Instead of coding the time range that you want the bells to play in the script, you can set up a more sophisticated event to execute the script. shows a recurring event that triggers once an hour, at 00 minutes, between the hours of 8:00 a.m. and 9:00 p.m (the "Apply Conditions to trigger" option limits its actions).
Figure 1. An event to play the chimes
Using this technique, you can create additional conditions under which to silence the bells, such as when you're not at home or have gone to bed for the night .
Before we set up HomeSeer to play at the proper times, first let's cover the script that plays the chimes. We want the chimes to play only between the hours of 8:00 a.m. and 9:00 p.m. (Try that with a grandfather clock!) So, the first thing the script does is to make sure it's between those hours. If it's not, no chimes are played and no one will be disturbed:
chime_volume_level = 3
if now() > cdate(date() & " 7:15:00 AM") and now() < cdate(date() & " 9:
05:00 PM") then
Note the space in the code between the time and AM or PM; it's necessary for the comparison to work correctly.
Next, examine the hour of the current time (h) and reduce it to a 12-hour clock, if necessary. That is, if the hour is 18, change it to 6 so that the correct sound file will play:
h = datepart("h", now())
h = cint(h)
if h > 12 then h = h –12
The script saves the current sound volume settings so that they can be restored later, then calls the hs.setvolume function to adjust the volume of the right and left channels to a lower level so that the bells aren't too loud:
prior_volume_level_left = hs.getvolume(0,0)
prior_volume_level_right = hs.getvolume(1,0)
Loud sound files result in low SAF.
A simple select statement plays the correct sound file, based on the hour value. HomeSeer's hs.PlayWavFile expects a complete path to the WAV file to play, so this script assumes the sound files are stored in the HomeSeer\ sounds directory:
select case h
Finally, the sound volume is restored to its previous setting:
Next, create a HomeSeer event that executes this script. I have it trigger at the top of every hour; it exits without playing the chimes if the time is outside the time range specified in the script.
My family really enjoys our virtual Big Ben, and my sons actually learned to count (to 12) by listening to it. Most importantly, though, my wife actually likes this feature of our home automation system. Who could ask for more?