Android and Linux

Tuesday, December 28, 2010

X10 coolness

I've been slowly getting into X10 home automation lately. It works like this, you get an X10 control module that plugs into the wall near the computer and a cable comes from it and plugs into your computer. Then you get software to control the control module. The control module controls whatever other modules you want to use throughout the house.

The most basic module is the lamp module, which is a small box that plugs into a wall outlet, then your lamp plugs into the module. From the computer, you tell that module to turn on or off.

What happens is that the control module sends a special signal through the wires in your house. The signal is picked up by all the X10 modules you have. The modules themselves have dials where you can select identification letters and numbers on them. You take a module and select, let's say, B4, so that module is now identified as B4. When you send the signal "B4 on," it turns itself on, which turns the lamp on.

There are numerous different modules to do different things. There are wall switches, modules for plug-in electronics like the lamp module and a similar appliance module, security modules, camera modules, dimmers, timers, weather sensors. Anything you can think of, the possibilities are endless.

You can also use them with remote controls and there are a few apps in the Android Market to run them from your phone, but I like setting them up to control from my phone over ssh. There is a Linux program called Heyu for use with the CM11A control module. Heyu can perform nearly two hundred different commands and uses simple command line syntax like heyu on B4. This makes it extremely simple to script, which in turn makes it extremely simple to control through the phone using the basic ssh command I've posted many times:

ssh USER@IP -i /PATH/TO/SSH/KEY 'heyu on B4'

This can be set up as a script to be ran from a terminal, through a GScript shortcut, or with Tasker. Of course, Tasker and X10 make an extremely useful pair.

I really haven't set much up yet except to manually turn a couple of lights on. I plan on getting a module to control the garage door next. This is done by using a "universal module" that acts like a single state button instead of an on/off switch. When the module is activated, it just does it's thing once and there is no way to reverse it. Every time it is activated, it is the same as pushing the garage door opening button so there is no way to know if it is up or down.

I plan to set it up with Tasker to activate it when I am close to home so the door will be open by the time I pull into the driveway. I'm not sure how reliable that will be, so I'll probably add a statusbar reminder that the door is open in case it is activated accidentally.

I've also considered getting a camera for the front door and a doorbell sensor. When someone rings the doorbell, the computer could tell the camera to take a photo then send it to me via MMS. If it looks like someone trying to sell something, I can ignore them. If it's a family member with a birthday present and I'm at work, I can open the garage door so they can come in.

I have no plans to do this, but this would be a cool setup...

Send a notification to the phone when the door is open

Have Tasker silence/ignore the notification if I'm at home and end the task.

If I'm not at home have Tasker say "Sir, I've detected that your garage door is open but you don't appear to be near your house. Would you like me to close it?"

Pop up the voice command window.

Using yes/no, open/closed, up/down as the keyword, I could answer in a natural voice and say "yes please close it for me" or "sure, close that sucker, I must have forgotten" or "nah, leave it up" or "it's ok, I want it open"

It could then say "Ok, closing it now," run the command to close the door and once the sensor detects that the door is closed say "It's closed, sir"

Like I said, I'm not going to do that, but it illustrates how well Tasker and X10 gear could work together to both perform really cool actions like opening doors for you and also make your phone behave somewhat like an intelligent assistant.