How I control my lights and appliances from my cell phone.

| May 14, 2007 | Reply

After watching a demo of linux mce on youtube, I became intrigued by X10, and what it can do for me.

[[X10]] is a standard of passing commands to lights and appliances through the existing [[AC]] power in a house.

With an inexpensive modules that plugs into your computer, it’s possible to send commands to your lights to turn on, off, dim, and hosts of other things.

I immediatly bought an X10 starter kit off of ebay for about $50.00. It came with more than enough for me to start the project.

The first step, was to plug the the tranciever module into the wall, and plug my computer into it. There is also a serial connection that plugs into the computer to send the signals. After plugging it in, I had to get linux to recognize the device and send signals. This took quite a while because of my inexcusable ignorance of how linux handles [[serial devices]].

After checking [[dmesg]] for serial devices in the computer, I came to the conclusion that there was only one.

#dmesg | grep tty
serial8250: ttyS2 at I/O 0x3e8 (irq = 4) is a 16550A

The serial device is /dev/ttyS2.

Now the device is connected, I needed some kind of software to control it.
Some googling suggested that MisterHouse would be a good start. So I installed misterhouse and was quickly overly confused by it’s bulk. MisterHouse is software that’s far more than I need… and it’s configuration and use is extremely confusing.

After I gave up on Misterhouse, I found a simple command line utility called [[heyu]].
Heyu sends X10 signals straight from the console using short concise commands like this:
#heyu on a1

This command would turn on the X10 device labeled a1.
Very simple.

This is exactly what I needed.

To take it to the next level, I wanted to be able to control my appliances from my cell phone.
Although there were some projects around the web that boasted the ability to do this, I was unable to find anything that worked… so what I did.. is simple.

I wrote a very short php script to execute heyu commands from the web.
It’s extremely simple and very lightweight.

And… here it is:

{codecitation} ‘Main Light’,
‘A3′ => ‘Red Lamp’,
‘A4′ => ‘Desk Light’,
‘A5′ => ‘Heater’,
‘A13′ => ‘Outside Light’
);
$currentstatus=shell_exec(‘heyu show h A’);
?>

offoffon

document.location=’index.php’”;
}//end if
{/codecitation}

This allows me to see the status of all my devices that I have specified in the array, and gives me the control to turn them off and on as I please. Now I don’t have to spend so much every year on heat… I can just warm the room up a few minutes before I get home.

You are obviously allowed to use and modify the above script to your hearts content.

-Luke.

Tags:

Category: Uncategorized

About the Author ()