MisterHouse is the name of the open source program I wrote to do Home Automation (HA) chores at our house. It runs on Windows 95,98, NT, or any POSIX enabled Unix, like Linux. It can interact with a variety of serial port devices, including the X10 CM11 interface.

Mr. Who?

Bruce Winter

winter-01.gif (9501 bytes)
Bruce Winter

MisterHouse is the name of the open source program I wrote to do Home Automation (HA) chores at our house. It runs on Windows 95,98, NT, or any POSIX enabled Unix, like Linux. It can interact with a variety of serial port devices, including the X10 CM11 interface.

Bruce lives in Rochester, Minnesota, with his wife and twin 13-year-old boys in a passive solar, earth bermed home. By day he is a mild-mannered engineer who helps design integrated circuits at IBM. At night, he turns into a Dilbert-like gadget guru, who will not be content until his house gets a PH.d. degree at MIT.


Mister Who?

MisterHouse is the name of the open source program I wrote to do Home Automation (HA) chores at our house. It runs on Windows 95,98, NT, or any POSIX enabled Unix, like Linux. It can interact with a variety of serial port devices, including the X10 CM11 interface. It can be controlled or queried via command line calls, tcpip sockets, a web menu, or a gui interface. On the MS Windows platform it also supports Voice Recognition (VR). It supports Text To Speech (TTS) on windows and linux, using freely downloadable TTS engines.

This article will give an overview of MisterHouse and give you pointers on how to download it and give it a test drive.

What/Why Open Source

By now I suspect the term 'open source' is pretty well understood, as so many of today's popular programs fall into this category. A definition can be found at http://www.opensource.org/osd.html The idea is that instead of making just the binary of a program available, the source code for the program is included as well.

So why would a person spend a year or 2 writing a program, and then just give it away, along with all the source code, on the Internet? Authors do it for a variety of reasons. Mine include:

Community spirit
I have benefited greatly from many open source programs. It just feels good to be able to contribute back to the world wide community.
Fame, not fortune
I am fortunate enough to have a good day job, so money is not one of my goals. Even if it were a goal, I think the success of a pay-to-play program is much less likely. When I go to pay for a program, I always have 2 concerns:

People are more confortable with open source because not only is it free, but its future is not dependent on any one person.

If money is a goal, I think a better HA business model might be not in selling the various programs, but in selling the service of installation and customization that is required to make it work in each home.

Faster program evolution
My real goal was to evolve a powerful program for my own use. The more people who use the program, the faster it evolves. More enhancement ideas, faster finding of bugs, and more code contributions. With computers and peripherals evolving at such a fast pace, one person could not possibly keep up with all the possibilities. But a community of HA enthusiast working together ... the possibilities are endless!

Perl

MisterHouse (mh) is based on a programming language called perl. Perl is a powerful, open source, multi-platform, semi-interpreted language that was first released in 1987. It quickly evolved into a key engine for many internet related tasks, so even if you have never seen it, you have probably used it.

With version 5 of perl, we can easily extend the language by building our own HA related objects and methods. For example, the following will create an object for a light and turn it on 15 minutes after sunset:

   $backyard_light = new X10_Item "C4";

   if (time_now "$Time_Sunset + 0:15") {
      speak "I just turned the backyard light on at $Time_Now";
      set $backyard_light ON;
   }

X10_Item, time_now, speak, $Time_xxx, and set are all HA related objects, methods, functions, and variables defined in mh. The rest is regular perl code.

Perl is a rich language. If there is not a built in function to do what you want, chances are pretty good there is one available via the perl CPAN repository ( http://www.perl.com/CPAN ). But for its use with mh, you don't need to know anything more that what you can learn simply by reviewing the example events that come in the mh distribution. In fact, several mh users have commented that running mh was a great way for them to learn perl!

If you want to dig into perl a bit more, a good starting point is at http://www.perl.com . THE reference book is Programming Perl, 2nd edition by Larry Wall, Tom Christiansen & Randal Schwartz, ISBN 1-56592-149-6. If you are looking for how to do something in particular, an excellent book is the Perl Cookbook, by Tom Christiansen & Nathan Torkington, ISBN 1-56592-243-3 Both of these books are available from http://www.oreilly.com or http://www.amazon.com .

Which platform

If you are like me, you may be on the fence on trying to decide what operating system to run your home control programs on. The Windows platforms offer the widest range of applications, but the unix platforms offer the best reliability. For example, today I'm running on Windows, because that's where the best Voice Recognition (VR) engine is. But running Windows for more than a week between reboots is a challenge. Linux, on the other hand, can go months between reboots.

With mh you can switch between the two environments without having to re-write anything! Perl runs the same way on both platforms. The Tk and web interfaces look the the same. The low level serial and TTS calls are different, but the high level calls that the mh user sees are the same, so no change in user event code is needed.

Interfaces

Here is what the web interface looks like:

 

Here is a picture of the Tk interface

Both of the web and the Tk interfaces are customizable and can be turned on or off as needed.

All of the defined voice commands show up on the Tk menu, the web menu, and the 'What can I say' voice interface

If you want to see a live web interface, try http://misterhouse.net:8080 , which, if our cable modem is up, will link you to mh running at my house. You will not be able to control anything without the password, but you can click on the various links and get a better feel for how mh works.

Event examples

I have uploaded all the mh perl code used to control our house to:
    http://members.home.net/winters/house/programs/code/Bruce

Here is a short discription of a few of the members in that directory:

curtains.pl
I have window quilt curtains hooked up to pulleys attached to 24 volt DC motors and a set of relays. Each curtain has 2 relays, an on/off and an up/down relay. These are driven either by local switches or by Weeder DIO outputs. curtains.pl will monitor outside temperature and sunlight levels, using a Weeder analog kit, and open and close the south facing curtains to maximize solar heat gain in the winter months.
deep_thought.pl trivia.pl
These modules will display and/or read a fun items from various databases. Makes for an entertaining breakfast!
door_monitor.pl
This module monitors door opening and closings using magnetic reed relays connected to Weeder DIO inputs. Do you have kids that leave outside doors open? This code will issue a friendly reminder, using the outside PA speaker, to close the door. It also monitors movements in hallways and stairways, using X10 movement sensors. When doors open and close, or people are sensed in key areas, I have mh play short, unobtrusive sounds, so you can tell where people are going. Sort of like a high tech squeaky door!
internet_data.pl
This module will retrieve and process pages from the Internet, like Letterman's top 10 list and local weather conditions and forecast. It also can set the clock according to an Internet-connected atomic clock.
internet_mail.pl
This code will use a background process to call the get_email script, which checks on who has sent you mail in specified email boxes. After the process has finished, mh will then announce what new new mail you have received, and from who.
pa_control.pl
Any call to the speak or play function can specify which room to talk to. This code will turn on and off the correct room's PA relay, using Weeder DIO output ports.
phone.pl
Using a Weeder Caller ID kit, this code will monitor incoming calls. There is code in the code/public directory that another mh user has created for use with caller ID capable modems. By sensing when the modem is not in use, this code can share the modem you use for Internet access.

An optional rule allows the sometimes unpronounceable phone book names to be translated to a pronounceable name or to play a pre-recorded wave file. The name of the city and/or state is also added, if the call is from an out-of-town area code. Using a Weeder DTMF kit, this code will also monitor and log outgoing calls. The display_callers script will display a list of all calls, incoming and outgoing, for any specified day.

telnet.pl
Using a user specified IP socket port, this code allows you to use a telnet program to 'log in', specify an optional password, and issue commands.
timer_seconds timer_minutes timer_hours
Like a kitchen timer, but it periodically tells you how many seconds/minutes/hours are left on your timer.
tracking.pl
This code was written by a ham radio enthusiast. Using a GPS unit and a pair of radios and TNC (terminal node controllers ... modems for radios), this code will track and announce his car's position and speed. Using an optional position file, it will announce with respect to various landmarks. (e.g. ``Dad's car has just left the IBM parking lot.'') This code does other nifty things with packet radio, like monitoring the current weather conditions from the nearest packet radio connected weather station.
tv_grid.pl
Using the get_tv_grid script in a background process, this code will collect customized TV programming from the Internet to local files, and add a 'program the VCR' button to the tv grid entry, so you can not only view what's on TV, but also instruct mh to create an event to start and stop the VCR at the specified time for the specified channel.
weather_monitor.pl weather_wx200.pl
This code will read data coming from a WX200 or WM918 weather station. It logs, displays, and optionally speaks weather data.

Installation and documentation

You can find the mh installation instructions at:
    http://members.home.net/winters/house/programs/README.html

The rest of the mh documentation is at:
    http://members.home.net/winters/house/programs/mh.html

We also have a mailing list (about 60 members as of 4/99) you can join at:
    http://www.onelist.com/subscribe.cgi/misterhouse

You can also review past messages at:
    http://www.onelist.com/archives.cgi/misterhouse .


Comments (0)

This post does not have any comments. Be the first to leave a comment below.


Post A Comment

You must be logged in before you can post a comment. Login now.

Featured Product

Light sockets; Not just for lights anymore

Light sockets; Not just for lights anymore

Smart Bulbs are out there and they can do far more then just provide light. Speakers, projectors, wi-fi extenders and more. The standard light socket that is wired up and ready to go in nearly every home in North America is now providing an easy and affordable option for home owners and renters alike to enter into the world of the "Smart Home". Here is a look at some of the Smart Bulbs and Smart Lighting options out there, and this list is just the beginning. In this ongoing article we hope to continue to add to and grow this list, so stay tuned!