Mar 142011

Many times as I sit in my car about to drive out my driveway I wonder “did I arm my security system?” In the past I would either pull out my phone, browse to my PowerHome website and check to see if it is armed, and if not I would arm it, or I would walk back into the house to check. I’ve got a homelink remote in my car which works great for opening and closing my garage door, so I wondered what it would take to have one of the unused buttons in my car arm my system. I don’t want to use any of the buttons to disarm my system for security reasons, but I don’t see any risk in setting it up to arm the elk. The steps below will tell you how I did it. It is a pretty easy install. Anyone that installed an Elk should be able to do this very easily.

Receiver. I did a little research and found that I could get LiftMaster receivers pretty cheaply (less than $50 depending on whether you need any remotes). There are a lot to choose from, so here’s some guidance. First of all, I got the LiftMaster 312HM, available in many places–search online. This model comes with an external antenna and operates at 315MHz. I believe you must get a receiver that operates at this frequency for the homelink to work. There are receivers out there that use 390MHz, so avoid those. The way the receiver works is that when a signal is received that has been learned into the receiver, the receiver electrically closes (shorts) the two output terminals for one second. This is perfect for integrating with an Elk. We can tie those two terminals to a zone input, set that zone to unsupervised, normally open, and write some rules for it to do the magic when the zone is “violated”. Perfect. Note that the 312HM is a single-channel receiver. There are dual- and three-channel receivers that allow you to program several remotes to it and close different terminals depending on which remote was pushed.

Mounting. I mounted my remote right next to my garage door inside my garage. I chose this location because I already had wiring run from that area back to my elk. This wiring was because I installed a magnetic sensor there to tell me if my door was closed. If you don’t have a sensor installed on your door, this might be a good time to do it. You don’t need the sensors for this project, but if you have to crawl under your house, why not kill two birds, right? I suppose mounting the receiver close to the door will also maximize the reception because the receiver will be physically closer to the car when someone pushes the button. You will also need to power the receiver. You could tap off the 12V outputs from your garage door, or you can buy the wall-wart transformer from Liftmaster model 85LM, which is what I did. I’m sure that other transformers would work if you found the right voltage and amperage.

Wiring. I suggest that you run four-strand wire from your mounting location back to a zone input on your elk. That way if you do decide that you need to connect something else, you will have a pair of wires ready.

Initial Elk programming. First set up the zone. Make it unsupervised, normally open. I also made it a fast-loop because the relay only closes for a second, and I wanted to be sure that the elk recognized it that fast. Probably not necessary, but I did it anyway. I also set it up as a type 16, non-alarm and chose to enable the chime, and I named it “Remote Arm”. Next, set up a simple rule so that you can easily tell if everything is working. Something like WHENEVER Remote Arm (Zn XX) BECOMES NOT SECURE THEN CHIRP THE OUTSIDE SIREN 1 TIME. You could have the elk say something, or just listen for the chime. Also, if you are close to the receiver, you will hear the relay click.

Receiver programming. I happened to have two remotes for my garage door–one for me and one for my wife. Since I had programmed the homelink in my car to open the garage door, I had a spare transmitter. The way I will do this is have one transmitter paired with the garage door. My wife keeps that transmitter in her car. I have that same transmitter learned into my homelink in my car. If you already had both transmitters paired with the garage door opener, you will need to unlearn all the transmitters and then relearn just the one transmitter. Now the other remote will be for remote arming through the 312HM, so we need the 312HM to learn that remote. To program the 312HM, press and release the learn button inside the receiver, and then press and hold the transmitter for a couple of seconds. Release the transmitter button. Press the transmitter button again and you should hear the relay click and your elk rule should fire. You are done programming the receiver… for now. I had to do some extra programming to get it to work with my homelink, so don’t put the cover on just yet.

HomeLink programming. I think of the homelink as being similar to those universal IR remotes where you had to learn new commands by putting the factory remote head-to-head with the universal remote. You then press a special key sequence on the universal and then the key on the factory that you want to learn into the universal. The universal just repeats what it learned. So, for the homelink programming, on my 2011 Acadia, I press and hold the outside two buttons for 20 seconds. The HomeLink indicator light flasshes fast to tell you it is in learn more. Press and hold the Homelink button you want to associate with the remote arming transmitter, and press and hold the remote arming transmitter. Watch the indicator light flash slow at first and then flash fast. At this point the homelink has learned the new transmitter. Press the new homelink button that you just programmed and hold it for about a second. With any luck, the 312HM will recognize the newly trained transmitter and do its mogic. In my case, it did not work. So I had to go to the backup programming instructions. Back on the 312HM, press and release the learn button. Then back in your car (you only have 30 seconds to do this, so you may need help), press and hold the newly trained homelink button for two seconds. If the receiver still does not respond, press and hold the homelink button again for two seconds. In my case, the 312HM always responded to the second attempt. I guess the 312HM uses some kind of encoding that is a little different than that of my garage door opener. The HomeLink system cycles through the different encoding methods each time you press it. Supposedly you may have to do this press and hold for two seconds exercise up to four times before the right encoding is found. At this point, you should be completely paired with one handheld transmitter and the homelink system. And your elk should be responding each time either of these are pressed.

Final elk programming. I wrote two rules for the elk. One, if the remote is pressed and the alarm is not armed, and two, if the remote is pressed and the alarm is already armed. First, set an unused output to help prevent both of these rules from firing at the same time. You see, with the Elk, so many things can happen in near simultaneousness, that you have to disable the second rule or it may actually fire at the wrong time. So I set an unused output to prevent the second case from running. It will all make sense when you read the code

Case number one
THEN TURN auto arm delay (Out XX) ON FOR FIVE SECS

Case number two
AND auto arm delay (Out XX) STATE IS OFF

So now, if I press the remote after the system is armed (like if I arm the system on the way out using the keypad but forgot by the time I got to the car. I’m old, it happens), the outside siren will chirp twice telling me it is already armed. I found that if I didn’t use that output to block the second case, both rules would fire when I pressed the remote button. I think I can do without the checks for the exit delays being acive, but for now, I do have them in.

So now I have both handheld remotes in my wife’s car, and I have both remotes programmed into the homelink in my car. In my car, I can press one homelink button to operate the garage door, and I can press another button to arm my security system. The third button is unused. One thing I have noticed is that with the homelink system, you do have to press and hold the button for a full second or two before it seems to do anything. WIth the handheld remotes, they respond much faster. So I have trained myself to press and hold the buttons when I want it to do something.

May 182010

I have been into home automation and home entertainment for several years. When I was having my current house built, I had a lot of pre-wire placed in the walls for security keypads, thermostats, cameras, speakers, and video. And I also placed empty conduit in my walls in a few strategic places just in case I hadn’t thought of everything when I built the house (I didn’t, because I have already needed the conduit. Several times.) Here, I thought I would discuss my Home Automation (HA) setup.

First, I have the ultimate in home security, the Elk M1G. It is fantastic because it allows ethernet connectivity for monitoring by Elk specific programs or third-party applications, such as PowerHome. The end result is, if I open a door that is monitored by my security system, my home automation software, PowerHome, can detect that and react as I so designate. For instance, if I open my front door, the Elk tells PowerHome that the front door is open. PowerHome can check to see if it is dark outside, and if it is, it can turn my porch light on automatically. Then after I close the door, it will turn the lights off after four minutes. Want a text message if your security system alarm goes off? The Elk can handle this quite easily. Throw PowerHome on top of that and I could also have all the lights in the house start flashing. Starting to get the idea?

I have mentioned PowerHome already, so let me tell you about it. PowerHome is a very customizable and programmable Home Automation program. The best way to use it is to keep it running 24/7 on an HA PC. HA PCs are nothing special (but it is probably a good idea to find one that draws as little electricity as possible). I also use my HA PC as a Home Theater (HT) PC. PowerHome can easily interface with my security system, the Elk M1G, my lighting control system, Insteon, and other human interfaces such as infrared remote controls, email, and text messages. Because of the excellent integration between the Elk and PowerHome, I can easily write PowerHome programs to monitor my security system and react to changes. Similar to the example above, I have also written a PowerHome program that monitors my motion detectors in my house. If no motion is detected for 45 minutes and the system is not armed, PowerHome sends my work email and cell phones text messages asking if I forgot to set the burglar alarm. I can also monitor my garage door, turn on my garage lights automatically when I open the door, turn on lights at sunset and turn them back off at sunrise, and many other handy convenient features.

So, how do I turn on my lights? I use a lighting control system called Insteon. It allows me to link lights to switches in nearly infinite configurations. For instance, if I wanted my bathroom light switch to also turn on my garage light, I could do that. I don’t know why I would, but I could. I can also set up lighting scenes, such as movie watching and entertainment. Insteon devices primarily communicate with each other over the powerlines themselves, so they are very easy to set up. And the beauty of PowerHome and Insteon… they can talk to each other. PowerHome does this by the use of a USB Insteon module that plugs into a wall outlet. So, if I do turn on my bathroom light, PowerHome can also know about it and also open my garage door, or tun my stereo off. Again, I don’t know why, but I could. And PowerHome can also tell lights to turn on and off as well, such as at sunset/sunrise or upon a door opening.

Since my security system, lighting, and PowerHome are all so tightly integrated, I can also use a web browser from anywhere in the world, or my cell phone, and turn lights on and off, arm and disarm the system, and open and close the garage door. Not only is this convenient, but it also increases the home security and safety of the house. I don’t forget to arm my alarm, close the garage door, or turn the porch light on at sunset. Lights come on as I enter dark rooms. And I can monitor the whole system very easily.

May 112010

I’ve mentioned my Panasonic BL-C1A network cameras before in a post about monitoring the garage door. I happen to have two of these cameras, and I have automated them to do quite a lot for me. The software that comes with the cameras is pretty lousy, and it makes you think you have to use Internet Explorer and nothing else to look at the images coming out of the camera. Well, I can tell you it’s not true. Although, if you want to use the ActiveX controlling software that comes with the camera, you are limited to only IE. Not good enough for me. I want to be able to see the images on my cell phone, and I don’t like being tied to a single browser, especially IE. For instance, wget (as I used in yesterday’s post about pulling images from a web site) could be used to pull the images from the camera. I also want the images to be saved on a web server so that if my cameras themselves are stolen, or if my home computer is stolen, I will still have a backup of the images. Now, I don’t normally store or watch video from the cameras, but instead focus on storing still images. I can watch video, but I don’t currently know of an easy way to save the video to my web server.

There will be several steps to this process. First install the camera. Next, set up the port forwarding on your router so you can view the camera from outside your local network. Then we will set up some cron jobs on the web server to retrieve and save the images. Finally we will set up a web page so we can view the images that have been saved. If desired, the entire system can be controlled by the home automation system, and I will show you how I did that as well.

The first thing to do is install the cameras. Install the cameras using the software provided, but don’t worry. We won’t be sticking with that software. Make sure you can connect to your camera from a computer on your local network, using the software provided. I would now recommend that you set static IP addresses for your cameras. It defaults that way, so this should not be a problem. The default IP address should be something like 192.168.x.253, where ‘x’ is the same number as the rest of your networked computers, probably a 1 or a 0. Also, set the port to some high number, such as 8001. You will also want to set usernames and passwords for the camera. Next, using the IP address for the camera, use your NON-Internet Explorer web browser to view the images by going to this website:
If that works, then we have lots of other options:




There is a little more information about these addresses here:

Great. Now we can see the images with any web browser. Video still requires a web browser that can handle java. Now let’s set it up so we can view the images from outside our local network by using port forwarding.

If you have a cable modem or DSL that is connected to the internet all the time, then you can probably set up port forwarding with that device. I use the world famous Linksys WRT-54G with the upgraded firmware DD-WRT. I certainly can’t tell you how to do this on every device out there, but port forwarding is quite common and searching google for “port forwarding yourdevicename” should give you a good place to start. However, the idea is simple. You want your router to recognize incoming traffic on a certain port and then automatically forward it to another port, such as 8001 in this case. The idea here is that you could be on a public computer in your library and go to and you will see the video on that camera. If you have more than one camera, you would go to the same site, but a different port number, such as I used the same portnumber, 8001, but you could use a different one. So I can go to http://mysecretsite:8001 from any browser and see the video. So I need to go into the firmware settings for the router, and I will want to forward any traffic that comes into http://mysecretsite:8001 to http://192.168.x.253:8001. The port forwarding rules will not need to know anything about “mysecretsite”, so you won’t find any place to enter that setting. All you will have to enter is the incoming port, outgoing IP address and outgoing port. The incoming and outgoing ports in this case are both 8001 and the outgoing IP address is 192.168.x.253. At this point you could check and make sure the port forwarding is working by going to your router’s IP address (find it by going to followed by :8001, such as

Related to the port forwarding is dynamic DNS. If you are lucky enough to have a static IP address, you can skip this paragraph. Otherwise you will need to follow the steps here to create a dynamic DNS host name. You can set up a free account at Once your account is set up, add a host service with a hostname that you can remember. Have it point to your current IP address for now, but you will want to configure automatic updating. You can either use free software or even easier, you might be able to configure the automatic updating right within your router. If it works, you should be able to go to your new host:×480&Quality=Standard&mode=local

and see the images from the camera. At this point step two is complete. You can save that URL and you will always be able to view your camera from any web browser on the internet.

The last step is to set up some cron jobs on your web server to grab the images from your camera and save them to a specific directory on your web server. This way you will be able to review past images as needed. It will require you to have a web server that you have shell access to. Some web hosts out there that do allow shell access do not allow scripts to run for extended periods of time. I use dreamhost (, which works perfectly.


while :
THISFILE=`date +/home/httpdocs/FamilyRoomWebCam/%Y%m%d%H%M%S.jpg`
wget --http-user=camera_user --http-passwd=topsecret -O ${THISFILE} -q
sleep 20
chmod 644 ${THISFILE}

As long as this script is running it will grab a new image from the camera every 20 seconds. It saves the images with a timestamped file name. You could configure this to start running at server startup, maybe have a cron job that checks to see if it is running periodically (like once an hour) and if it finds that the script is not running, restart it. I have it set up so that whenever I arm my burglar alarm (Elk M1G), the elk sends an email to my web server with a special code. Procmail reads the email and if it sees the special code, it starts (or stops, on disarming) the script. Here is my Procmail script to start the web cam:
* ^Subject:.*SecretStartCode
| /home/script/ &


Finally, I have another cron job to delete old pictures every night. Otherwise the picture directory would get very full very fast. I don’t think dreamhost would like that at all.

find /home/httpdocs/FamilyRoomWebCam -mtime +3 -exec rm {} \;

This will delete any pictures older than three days old.

The very last step is I wrote a small web page to display the images. It uses javascript to play the images in a slideshow, or it can display all images from a specific time period. For now I will leave that up to you, but I will post the code for it in a few days.

May 052010

Inevitably after I get comfortable in my couch to watch a good movie, I realize that I haven’t set my room lighting to the optimal levels. Or I realize that I have left lights on upstairs. Because I am lazy, I don’t want to get off the couch to dim the family room lights or even worse, go upstairs to turn those lights off. Instead, I just press a button on my Harmony remote control and the lights are set however I want. You will also need an USB-UIRT to receive the IR signals and a 24/7 computer running PowerHome to do the work (I use my HTPC). Of course, you will also need some type of automated lighting. I have Insteon to control my lights.

You could do this with an old, unused remote, but I don’t like to have any extra remotes lying around my family room, so I really prefer the Harmony remote for this. If you don’t have a Harmony remote, and you don’t want to bring another remote into your living room, one other option would be to assign an unused button on your current remote control to be your lighting button. The whole idea here is you need transmit a unique IR signal such that whenever it is seen, it will, say, turn your upstairs lights off. If you do have a Harmony, you can add a new device that you don’t currently have in your home theater (you don’t want to be sending out signals that actually do something). Then you can go to the adjust buttons menus and Rename the labels for the soft buttons. Label one “Upstairs” and one “Fam Room”. It doesn’t matter what the IR command is. It could be channel up, the number 8, video toggle, mute, or anything else. We will learn the commands into the USB-UIRT and PowerHome, so it doesn’t matter what command is coming out of the remote.

Next, install the USB-UIRT and make sure it is working. To do that, just… um.. plug it in. They are pretty much fool-proof.

Next, we need tell PowerHome that you have a new controller. Go to the PowerHome explorer and expand the Setup branch and add a new Controller. You will see that there is already support for the USB-UIRT. Go into the settings for the device and set the type to “Pronto”. Shut down PowerHome and restart. PowerHome is now ready to receive IR triggers.

Next go into the PowerHome explorer and expand the Setup branch once again. This time go to Devices. Add an IR device and set it for about 20 IR commands. Then you can expand the newly added device in the navigation tree and start learning IR commands. Right click on a blank row and choose “Learn IR”. Take your remote control to the USB-UIRT and press the button corresponding to the command you are learning. I have found that you have to get an inch or two away from the UIRT when learning commands. If it learns OK, you should see an ASCII string representing the command.

Now we need to add a trigger for the newly learned IR command. But before we can do that, we need a macro that will be executed whenever the IR command is detected. Build a macro that has the one line INTSTEON GROUP OFF and select the group corresponding to your upstairs lights. Run the macro and ensure your upstairs lights turn off. Now build that trigger. Select the trigger type to be IR, select the device and command. Enter in the macro to be run and you should be good to go. Press the button on your remote and the lights should turn off.

The final step is to click over to your HTPC, start a movie that you have ripped to your hard drive, turn off the lights and enjoy :)

May 012010

I am paranoid about closing my garage door. Or leaving it open. Whatever. I don’t think I’ve ever had anything stolen out of my garage, or any nefarious person (or varmint) enter my house through my open garage door, but I am paranoid about it nonetheless. Have you ever left for work in the morning, walked out to your car to see your garage door wide open?  Or have you ever come home from work to see you garage door open because you forgot to close it on your way out of the driveway in the morning? Me too. So I take matters into my own hands now. It would be impossible for me to leave my garage door open with me at home or away. Can’t happen. Would you like to know how I do it?

First, the required equipment and software:
I have an Elk M1G Security system
I use PowerHome for home automation
Optional, for the really paranoid, I have a Panasonic network camera which can watch the door
and I needed one addition magnetic zone sensor

My house did have a burglar alarm installed when I bought it, with sensors on all of the first floor doors and windows *except* the overhead garage door. I believe this is common practice for new homes, but I may be wrong. My house also came with a very inexpensive, builder’s grade burglar alarm. I immediately replaced it with the Elk M1G because it offers so much in the way of home automation. More about the M1G in later posts here for sure. I then installed a magnetic sensor on the garage door so the M1G would know when the door was open and closed. I have a home theater personal computer (HTPC) which also does my home automation. It is on 24/7 and I don’t know how I would live without it. It is the same closet where my burglar alarm is installed. I have PowerHome installed on that computer, which is capable of communicating with the Elk over IP. Finally, I ran a pair of wires in parallel across the “doorbell” switch in the garage back to a relay output on the Elk. The Elk has inputs and outputs, just like any computer. Zone sensors are inputs, but in this case I hooked up this wire pair to an output. The Elk can control the output (that is, electrically close or open the output) as required. It’s nothing more than a relay. The idea here is I want the Elk to be able to close the garage door, so I gave the Elk its own set of wires which bypass the doorbell switch in the garage. With that, I have everything that I need to complete this project.

The Elk keypads have four programmable buttons which can also be illuminated based on rules. I wrote a rule and function to illuminate a button whenever the garage door was open. I wrote a function to close the output that I connected the doorbell wires to above for one second when I press that button. So I press the button on the Keypad, the Elk interprets that and says “oh, he pushed the button, so I need to close this relay for one second”. Closing the relay for one second is the same thing as pressing the doorbell switch in my garage for one second because I have wired that relay as a bypass in parallel across the doorbell switch. I also added some logic so I can’t accidentally open the garage door from the keypad. The logic checks to see if the door is already closed, and if it is, it doesn’t do anything else. Therefore it won’t accidentally open the door. Great, so I can so look at any keypad in my house and see if the door is open or closed. And if it is open, I can close it. But that’s not good enough.

The Elk M1G is also capable of voice enunciations. I have my Elk connected to a couple of in-wall speakers throughout my house. Now, whenever my garage door is opened, the Elk starts counting down from 60, decrementing by one each minute. When it hits zero it announces throughout my house “Garage door is open” and then resets the counter. So I get hourly reminders that my garage door is open.

I also have PowerHome check to see if the garage door is closed seven minutes after the security system is armed. If the door is not closed, then PowerHome sends me, and my wife text messages on our cell phone, and our work email address a notification that the burglar alarm is armed, but the garage door is open. PowerHome has a built in web server and I have written a front end that can also display the status of the garage door, and of course, it also has a button that I can click and close the garage door. All this is accessible with our cell phones or any web browser.

And yes, I am really, really paranoid, so I also have a Panasonic IP camera in the garage so I can pull up a web page that stores the most recent images from the camera and verify visually whether on not the door is closed.  More on the Panasonic cameras in a later post.

As you can see, I am really paranoid about my garage door.  But I can tell you I have not left it open overnight in years.  Nor have I come home from work to see it wide open either.  This functionality gives me a lot of peace of mind and I am really glad that I have automated every aspect of my garage door.