I recently acquired a Raspberry Pi, and my main project is to get X10 stuff working again in my house.
To that end, I purchased a CM19a. I'm going to chronicle the process of getting it working here, so that eventually this will be a helpful howto. At the moment, it's just a collection of notes and frustration. If you know something I don't know, *please* let me know.
First, plug in your CM19a to the USB port.
dmesg. You'll see something like:
[ 11.236260] input: X10 Wireless Technology Inc USB Transceiver as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/input/input0
[ 11.436218] usb 1-1.3: Weird data, len=1 ff 00 ff 00 00 00 ...
[ 11.447235] usbcore: registered new interface driver ati_remote
[ 11.584656] ati_remote: 2.2.1:ATI/X10 RF USB Remote Control
Also, when you run
lsusb you'll see:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0bc7:0002 X10 Wireless Technology, Inc. Firecracker Interface (ACPI-compliant)
/dev you'll see:
rbowen@raspberrypi ~ $ ls -la /dev/usb*
crw------T 1 root root 189, 0 Jan 1 1970 /dev/usbdev1.1
crw------T 1 root root 189, 1 Jan 1 1970 /dev/usbdev1.2
crw------T 1 root root 189, 2 Jan 1 1970 /dev/usbdev1.3
crw------T 1 root root 189, 3 Jan 1 1970 /dev/usbdev1.4
So far, so good. Linux sees it.
[I'm not yet sure if this part is necessary. Still trying to figure that out.]
You'll need to create /dev/ttyUSB* to go along with that. Paste this at the shell:
for i in 0 1 2 3 4; do
sudo mknod /dev/ttyUSB$i c 188 $i
Note: 1) This is a magical incantation. I don't yet know what the args to mknod mean. 2) I did 0..4 because lsmod shows devices up to 4. If you have more, make more.
It appears that 'heyu', which I used with the serial device I used to have, doesn't support the CM19a. Disappointing. But it looks like mochad does, so I'm trying that. Unfortunately, it appears that mochad doesn't support extended status reporting (ie, the bit that tells you to what level a particular light is dimmed).
Get mochad. Build it and install it as per the instructions at https://sourceforge.net/apps/mediawiki/mochad/index.php?title=Main_Page..
At this point, it's probably easiest to reboot the box, so that libusb gets loaded right, and mochad starts up correctly.
You should now be able to send commands to your device with netcat from anywhere on the network (or on the box itself)
echo 'rf f2 off' | nc raspberry 1099
Where, in this case, raspberry is the network address of my raspberry pi.
On the box where mochad is running, you can watch progress with:
nc localhost 1099
which will show the commands as they arrive:
01/02 21:51:12 Tx RF HouseUnit: F2 Func: Off
Now, the only problem is that my lights aren't actually turning on or off. Perhaps a project for later this evening.
Update: I think maybe the RR501 I was sending to was defective? Not sure. Anyways, I swapped it out with a TM751 I also had sitting around, and now I can turn lights off and on. Next challenge, some kind of automation scripts that do more than one action at a time.
Update2: Seems maybe the CM19A has a range problem. I put the raspberry pi back in the network closet, and now stuff has stopped working.
Update3: No, that was an idiot problem - I had an argument misspelled in the shell script that was calling the X10 commands. Everything seems to be working now. However, for now, it's all set up down in the living room, with rather more cables behind the stereo than I really care for.
Problems remaining to be solved: Why do /dev/ttyUSB* need to be recreated at each boot?
Update4: Having the perennial Linux problem where something works, and then stops working on reboot. Gah!
Update5: Using OpenRemote to create an Android app that is a remote control for my home's lights. Very cool. However, I'm encountering a bug that was theoretically fixed two versions ago. Bummer. The remote controller establishes TCP connections to mochad and never releases them. Eventually, you can't make any more connections and it just stops responding.
Update6: I've forked mochad on SourceForge and will be tinkering with stuff there for the moment. Right now I'm working on fixing the CGI stuff to be more generic. What's in the main repo is hard-coded to talk to mmauka's home setup, and obviously that doesn't work for me. I'm not sure I want to develop a full CGI controller solution ... but I might. We'll see.
Upodate7: MisterHouse (http://misterhouse.sourceforge.net/) appears to still be active, so perhaps I'll play with that some, too.