This Instructable is part of the "Adafruit Make It Tweet Challenge", so if it's before June 30, 2011. please vote!
Yes, it's that X-10. The company with the super annoying, flashy banner ads that used to be everywhere selling creepy, stalker-worthy, video cameras also sells home automation devices, and they're cheap!
Note: X-10 is the company, and X10 is the protocol. I'm going to try to keep it straight.
Step 1: Required Hardware
You will need:
- Computer running Linux with an always on internet connection
- Serial port (a USB to serial adapter is fine - Meritline )
- CM11A (Ebay )
- LM465 (Ebay )
These instructions will allow for multiple devices to be controlled. When all is said and done, it should be pretty straight forward how to control more than one device.
Note: I have no affiliation with X-10, Meritline, Ebay, or any Ebay sellers.
Step 2: Install the LM465 and a Lamp
After choosing the house and unit code:
- Set the code on the LM465.
- Plug the lamp into the LM465.
- Plug the LM465 into the wall.
Hooray! We're well on our way to controlling that pretty little lamp with Twitter!!!
Step 3: Install the CM11A
- Plug the included cable into the CM11A.
- Plug the CM11A into the wall.
- Plug the other end of the included cable into your computer.
Step 4: Install Heyu
Basic steps are:
- Download the latest version of Heyu (here )
- Decompress the file (tar zxvf heyu-VERSION.tgz)
- Change to the directory where it was decompressed (cd heyu-VERSION/)
- Run the configure application (./Configure)
- Run make (make)
- Run make install as the super user (sudo make install)
Now, if you run "heyu on B7" at the command line the light should turn on. If it doesn't, you may need to edit the heyu config file. The heyu FAQ page is a good place to start.
HEYU is a trademark of Daniel B. Suthers.
Step 5: Get a Twitter Account for Your Computer
- Go to Twitter.
- Register an account for your computer.
- Make that account follow you.
- Optionally, follow that account.
Step 6: Get a Key and Secret From Twitter
Using the key and secret you got from Twitter, you can use the Twitter Three-legged OAuth Example to generate your OAuth token and OAuth secret.
Those four hashes, the OAuth Token, OAuth Token Secret (from the Three-legged example), Consumer Key, and Consumer Secret (from Twitter), separated by line feeds, go into a file named "Twi_X10.conf".
"Twi_X10.conf" should look like this:
Note: Please excuse me if I've messed up some of the OAuth terminology.
Also note: If you want to read up a little bit more on Twitter's Basic Auth to OAuth transition, read here .
Also also note: The "Read, Write, & Direct Messages" access bit is a new requirement. If you got your keys before June 30, and hadn't set that permission, the script may have stopped working. You will need to make sure the permission is set properly in the application settings, and get a new key/secret combination.
Step 7: Download My Python Script and Add Users
Make another file, named "Twi_X10_Users.conf" (in the same directory), and put the Twitter handles of the people you want to be able to control the X10 devices (separated by line feeds).
"Twi_X10_Users.conf" should look like the following:
You may be thinking to yourself, "Why is this necessary? No one can send a message to my computer's account unless my computer is following them." You'd be right. This is duplicating that restriction. I added it in originally, and it's still there. We're moving on.
Step 8: Run the Python Script
"chmod +x Twi_X10.py"
Run the Python script
Now, tweet the following (replacing COMPUTERTWITTERACCOUNT with the account you created in step 5):
"d COMPUTERTWITTERACCOUNT x10&on B7"
Wait a second or two, the light should go on, and your computer should reply with a tweet that says:
"Sun Jun 26 12:00:00 2011: on B7 from YOU, status: OK"
"d COMPUTERTWITTERACCOUNT x10&off B7"
will turn the light off, and you'll get a response along the lines of the following:
"Sun Jun 26 12:00:00 2011: off B7 from YOU, status: OK"
Congratulations, you can tweet that lamp on and off!!!
The "x10&" needs to be the first thing in the message. After that, anything that you can put on the heyu command line is fair game. The application simply replaces the "x10&" with "heyu" and runs that command at the command line.
Step 9: Expanding Your Setup
Also, vote for me in the Make It Tweet Challenge!