Monday, September 3, 2007

Misterhouse Insteon PLM Configuration

Although X10 supposedly works very well in Misterhouse it seems that X10 is falling out of favour mostly for reliability and marketing reasons. I made a conscious decision to go with Insteon technology instead of X10 for lighting control in Misterhouse even though Insteon compatibilty in Misterhouse is in its early stages.

So, last week I received the Insteon devices that I ordered and I could hardly wait to start playing with them. This is what I got:

2412S INSTEON PowerLinc Modem, Serial
2456D3 INSTEON LampLinc Dimmer (3-Pin)
2476S INSTEON SwitchLinc Relay (Non-dimming)

I did a fair bit of research on the forums etc. before I decided to buy these. From what I understand the USB version of the PowerLinc isn’t quite ready for prime time in Misterhouse although there are people working on that. The 2412S INSTEON PowerLinc Serial Modem (PLM) is a dumb controller that connects to a serial port on the computer. I figured that since I have an available serial port I might as well go for this one.

I started to try and get the devices working with Misterhouse right away. That was actually a big mistake. I still have so much to learn about Misterhouse itself that trying to understand how Insteon and Misterhouse work together at this point is just too onerous. What I needed to do was learn how the Insteon technology works first before I can even think about integrating it into Misterhouse. So, I found a number of documents on the web that have proved to be very helpful for a start.

http://www.simplehomenet.com/Downloads/EZBridge%20Manual.pdf

http://www.smarthome.com/manuals/2412sdevguide.pdf

http://www.insteon.net/pdf/insteondetails.pdf

At the back of the EZBridge document is an appendix with Insteon Commands.

After reading this material over a couple days my first step was to play with the PLM and a LampLinc to see if I could turn a lamp on and off. I have a Windows PC that I work on and Misterhouse is installed on a Linux server in another room. So to experiment and learn how Insteon commands work I downloaded and installed a recommended software program called Docklight.

http://www.docklight.de/

This is trial version that gives you enough functionality to experiment with Insteon commands on a Windows PC. What this program lets you do is send commands to the PLM through the COM port on your PC. There’s a screen shot of Docklight on page 9 of the Modem Developer’s Guide. I learned a great deal just from studying that screen shot. Once I got a basic understanding of how Insteon commands work I was able to turn my lamp on and off using my Windows PC.

Now that I had a basic understanding of how to communicate with the PLM using the serial port I needed a way to do the same thing on my Linux server. After hours of futzing around with programs like Minicomm and others I discovered this great little utility, S-Jinn.

http://sjinn.sourceforge.net/

This is a neat little command line program that lets you communicate through a RS232 com port. I connected my PLM to a free serial port on the linux server and after a couple hours of learning the program and experimentation I came up with these commands that turns the lamp on and off using S-Jinn.

Here’s an explanation:

------1------ ---2--- --------------3-------------- --4-- ----5---- -5- ----6----
$: rs232 -d /dev/ttyS6 -b 19200 -s "\h02 62 FF FF FF 0F 11 FF" --hex --verbose -r9 --wait .4
$: rs232 -d /dev/ttyS6 -b 19200 -s "\h02 62 FF FF FF 0F 13\n" --hex --verbose -r9 --wait .4

1. Device (-d /dev/ttyS6): on my system the PLM is connected to /dev/ttyS6

2. Baud rate (-b 19200): I read in some places that the baud rate should be set to 4800 but that didn’t work for me. 19,200 was the only rate that gave me joy.

3. Send string (-s "\h02 62 FF FF FF 0F 11 FF"): This is the hexadecimal Insteon command that gets sent to the PLM. The \h is a hex toggle. The “02” is the ‘start of text’. The ‘62’ tells the PLM an Insteon command is coming. The next three bytes ‘FF FF FF’ is the Insteon ID. I got this off the label on the back of the device itself. The ‘0F’ is a flag indicator. The next two bytes are the Insteon command that gets passed to the LampLinc. The ’11 FF’ is ON with full brightness. The ‘13’ is OFF. I had to put a \n at the end to get the command to work.

4. Display in Hex (--hex): Displays the out put in hex.

5. Verbose output (--verbose): Self explanatory

6. Wait 0.4 seconds (--wait .4): This setting seems to work.

Now that I have a really super basic understanding of Insteon technology and the commands required to make it work. My next step is to figure out how to get Misterhouse turning the lamp on and off.

I'm off to study Neil Cherry's work on this page...

http://www.linuxha.com/athome/common/iplcd/

Hopefully this will help someone.

Garry

Thursday, August 16, 2007

In the Beginning

I admit that I'm a total geek! I love technology, especially computer technology, and gadgets.

A number of years ago I was sitting on my couch watching TV and got really annoyed at all the commercials I was being subjected to. I thought to myself, "there must be a way that I can watch TV and skip all these annoying commercials". At the time, Tivo was all the rage so I did some online queries about that technology. It was then that I came across a link for MythTV.

http://www.mythtv.org/

Right then and there I began my adventure into the world of Linux and open source software. I built myself a MythTV box and it has been running faithfully ever since (except when I break it by tweaking this or that).

Then one day, around dinner time, the phone rings and it's one of those annoying telemarketing calls. After I blew the person off I thought "there must be a way I can screen these types of phone calls and blacklist telemarketing calls". That's when I learned about Asterisk and FreePBX (formerly Asterisk@Home).

http://www.asterisk.org/
http://www.freepbx.org/

I installed Asterisk and FreePBX on another box in the house, bought an ATA (analog telephone adapter) and before long I had the fanciest answering machine on the block. And, yes I could now screen those annoying calls.

Before long, during my research for these projects I came across discussions in many of the forums about home automation and smart home technology. Again, being the geek that I am, I was hooked on the idea.

The first software program I tried was Plutohome.

http://plutohome.com

This is pretty amazing software that was put together for a commercial hardware product that's meant to be a whole home system that combines media and entertainment, security and telecom control in one easy to use and to install package. The company that created the product decided to make the software open source for individuals which means it's free to use for personal use.

I really liked Plutohome. It was a breeze to install and the web interface and the concepts of Plutohome are very slick and easy to use. But, what I soon discovered is that some of the packages used for Plutohome such as MythTV and Asterisk are quite dated. Because Plutohome was designed to be easy to use and install I also found it didn't offer the flexibility that I was looking for. And, although there is a very nice and helpful community (including Plutohome support staff) it seemed the community isn't that large and development is quite slow.

That's when I decided, what the heck, I’m a sucker for punishment. I’m going to build my own complete system from scratch using the latest MythTV, Asterisk, FreePBX releases and a home automation program called Misterhouse.

http://misterhouse.sourceforge.net/

Hopefully, at some point in the future I’ll have them all working together seamlessly.

Misterhouse uses PERL programming and is amazingly flexible and powerful. But, with that flexibility and power comes complexity. Since I’m new to Misterhouse and don’t have any PERL programming experience, and, I’m a relative novice when it comes to Linux, I have to admit, I’m feeling a little overwhelmed. I have so much to learn.

That’s the reason for this Blog. I thought it would be a good idea to chronicle my experiences not only as a resource in case I had to rebuild my system but also it might help anyone out there that’s a newbie like me.

Thanks for reading…

Garry