Controlling X-10 switches with SmartThings using Hue Bridge emulation

Update [Jan-28-2018]

While this solution has an advantage that it exposes X-10 devices to Alexa, Google Home etc, it requires the devices to be maintained in HA-Bridge, and setup is a little tedious.
I have published another solution, which has better integration with ST and support X-10 remotes and motion sensors as well.


Controlling X-10 switches with Smartthings.

There are several ways of bridging X-10 devices with Smartthings. I have tried a few, and found the following to be the simplest way of doing it. It does require a Raspberry pi and moderate level of technical skills. This may look a bit much, but actually its pretty quick and quite simple. As of now only on/off functions are supported using this method - dimming functions are not supported.

This method uses HA-Bridge with emulates a Hue Bridge, hence once this is setup not only will the X-10 devices be available for use with Smartthings, they can also be discovered directly by any system that supports Hue, including Alexa and Google Home.


  • Raspberry Pi

  • Mochad and CM15A or CM19A USB Devices
    Mochad exposes a TCP interface to X-10 commands, and can run on any linux system including Raspberry PI. It uses CM15A or CM19A USB devices to communicate with X-10 over RF or powerline. Using these devices you are not limited to a single house code, you can use any of the 15 house code with any x-10 device.

  • HA Bridge BWS Systems
    Home automation bridge that emulates a Philips Hue light system and can control other systems including mooched using tcp interface.


Step 1: Install Mochad on Raspberry Pi

Follow any number of tutorials to setup your Raspberry Pi using your favorite distro, make sure you install the development tools. On Raspbian you can do this using the following command

sudo apt-get install build-essential

Build mochad

  • Install libusb-1.0.0 development files. mochad will not build without this.

    $ sudo apt-get install libusb-1.0-0-dev

  • Get mochad source code and unpack it.

    $ wget -O mochad.tgz
    $ tar xf mochad.tgz
    Now build mochad.
    $ cd mochad*
    $ ./configure
    $ make
    $ sudo make install

  • Edit /etc/udev/rules.d/91-usb-x10-controllers.rules change the following line to :

    RUN+="/usr/local/bin/mochad &"

    This ensures that mochad will load whenever the usb device is detected, include when Raspberry pi reboots

Blink a lamp

  • Plug in a CM15A, CM19A, or CM15Pro into a Raspi USB port. Connect a lamp to X10 module set for address A1.

  • If using a CM15A or CM15Pro try the following power line (pl) commands.

    $ echo “pl a1 on” | nc localhost 1099
    $ echo “pl a1 off” | nc locahost 1099

  • If using a CM19A try the following radio frequency (rf) commands.

    $ echo “rf a1 on” | nc localhost 1099
    $ echo “rf a1 off” | nc localhost 1099

    At this point you should make a list of commands that you need to turn your X-10 devices on and off, you will need this later.

    credit - X10 Linux: Installing mochad on a Raspberry Pi

Step 2: Install HA Bridge
Note:You can find the link to the latest release jar file on this page Releases · bwssytems/ha-bridge · GitHub - the rest of these instructions are for version 4.5.6.

Setup Java 8 JDK
If you already have JDK 8 installed on your system you can skip this part and proceed to the next section ‘Download &Setup HA-Bridge’

  • Download and Install Java 8 JDK

    sudo apt-get update && sudo apt-get install oracle-java8-jdk

  • Set the default Java version

    sudo update-alternatives --config java

    And select the JDK 8 version (/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java).

    Then verify the java version

    java -version

Download &Setup HA-Bridge

  • On your Raspberry Pi, make sure you are in the Pi home folder

    cd /home/pi/

  • Then make an habridge folder:

    mkdir habridge

  • Now change to the folder and download the latest ha-bridge jar file

    cd habridge

  • Creates the data folder

    mkdir data

  • Now you have to create the systemd service file

    nano habridge.service

  • Then copy and paste the following in this file

    Description=HA Bridge

    ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-4.5.6.jar


    Now, to save the file, hit CTRL-X, then hit Y and RETURN

  • Next you need to enable the systemd service so it will automatically start every time you reboot your Raspberry Pi

    sudo systemctl enable /home/pi/habridge/habridge.service

  • Now that it is enabled, you have to start it. Since it is enabled, you don’t need the full path to run it

    sudo systemctl start habridge

    The default port for HA Bridge is 80, so open your browser and go to your RPI address, port 80:

    If you have a conflict on port 80 and need to run HA Bridge on a different port you can change the default port in the habridge.service file by changing the ExecStart line

    ExecStart=/usr/bin/java -jar -Dserver.port=8080 -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-4.5.6.jar

    credit - General Ha-Bridge Guide (Hue Bridge for Alexa or Google Home) - Third party integrations - Home Assistant Community

Step 3: Putting it all together - Setup X-10 devices in HA-Bridge

  • Open a browser window and navigate to http://ipforyourpi:port (e.g. http://pi:8080). You should see the HA Bridge configuration screen. This screenshot is my configuration, yours will be empty at first.

  • Click on “Add/Edit” from the top of the screen. This will take you to the new device entry screen.

  • In the ‘Name’ field enter the device name - this will the be name that will appear in Smartthings as well as Alexa/Google Home when this device is discovered

  • In the ‘Description’ field Add a description

  • For the ‘Device Type (Informational)’ field select ‘Custom’ from the drop-down

  • Scroll down the the screen to the Items section

  • Go to the ‘On Items’ section, for the ‘Type’ field select ’TCP Device’ from the drop down. Add the command to turn on your X-10 device in the ‘Target Item’ field. for example:

    tcp:// a4 on \n

    Please note the \n at the end of the line

  • Now Press the green ‘Add’ button on this line

  • Go to the ‘Off Items’ section, for the ‘Type’ field select ’TCP Device’ from the drop down. Add the command to turn off your X-10 device in the ‘Target Item’ field. for example:

    tcp:// a4 off \n

  • Now Press the green ‘Add’ button on this line

    In this example the mochad server is running on the same Rasperry Pi as the HA Bridge and we are controlling switch A4 using the X-10 RF protocol - Adjust the parameters to your settings accordingly

  • Next go to the top of the page and click “Add Bridge Device” to add this to the list of devices. You should now see this when you click “Bridge Devices”. Click “Bridge Devices” and click “Test On” or “Test Off”. If all is configured correctly your X-10 devices should respond

  • At this point all your configured devices will appear as Hue lights - follow the instructions in the How to connect Philips Hue devices page to configure the HA Bridde as a Hue hub

Interesting. Looks like this approach could be adapted to work with the “Project WiSH” driver too (, which appears to support some interfaces that mochad doesn’t (specifically, the CM11A serial-to-powerline interface and the CM17A “firecracker” serial-to-radio transmit-only dongle). Since those are oriented toward command-line echo-to-device operation, all that would be needed would be a simple server to parse and issue the commands. Or it might be able to kluge communications into the webserver interface in that package, or that could be adapted to support a RESTful API.

Now my question is how hard it’ll be to convince a Raspberry to talk serial…

1 Like

Should be a piece of cake with one of those cheap serial to USB convertors - I have done that before for other devices with one of those cheap ebay Chinese things. Just look for RS232 to USB cable, ‘serial’ can also mean TTL, which is not RS232.

TBH I have tried those approaches before for various projects, there are several moving parts usually, that is why I like HA-Bridge so much, its simple.

Since wish seems to be a command line interface and HA-Bridge can also call local scripts, I would make a couple of simple on/off scripts that take parameters and pass the house code and device ids etc as parameters to the script.

BTW Thanks for introducing me to wish - I wish I had known about it years ago, could have save money and not thrown away the older serial devices

looks like some has an updated version on this on github -

I’ve taken a quick pass at getting Wish v2 installed on the Pi; issues found and fixed have been documented in Wish’s mailing list.

Unfortunately that doesn’t mean I have it running yet; modprobe says there’s an exec format error, and it’s been long enough that I’m having trouble remembering how to chase that down.

If I get it working, I’ll post more updates there. If not… The CM11a’s protocol is well documented; if all else fails I’ll just write a simple serial-port daemon.

Just set this up and mochad doesn’t automatically launch. I ran it manually and it is saying that it can’t recognize my CM15A X10 Device.

(Could not find/open CM15A/CM19A -5)

I then ran the lsusb command to see if the Device was connected, and it seems that it is.

(Bus 001 Device 007: ID 0bc7:0001 X10 Wireless Technology, Inc. ActiveHome (ACPI-compliant))

Edit: Is there a driver I need?

Has anyone gotten HABridge working with the CM17A Firecracker? I’m able to control my lights through that from my Pi, looking for an easy way to get them into Smartthings.

What are using to control CM17A? Is there a command line interface?
if there is a script, you should be able to set the on command and off command in HA-Bridge - it the ‘Type’ field drop-down for On and Off commands choose "Execute command script/program’ instead of TCP Device.

you need libusb-1.0-0-dev did you install that? mochad is usually pretty painless.

can you run mochad -d and share the output.

I’m using heyu, should work. Right now I’m trying to see if the HA Bridge can be added to Smartthings.

LOL I based this solution on an instructable using ha-bridge with heyu - here is the link, tells you exactly what you need to do

I installed the libusb driver.

I’m getting this when I run mochad -d
mochad[3078]: usb_claim_interface failed -6
mochad[3078]: Could not find/open CM15A/CM19A -5

You try looking for help in the sourceforge forum - mochad / Discussion I have installed mochad several times over the years, rebuilidng pi’s mostly and haven’t had issues.

Cm19a = 0;
*devhptr = libusb_open_device_with_vid_pid(NULL,  0x0bc7, 0x0001);
if (!*devhptr) {
    *devhptr = libusb_open_device_with_vid_pid(NULL,  0x0bc7, 0x0002);
    if (!*devhptr) {
        syslog(LOG_EMERG, "libusb_open_device_with_vid_pid failed");
        return -EIO;
    Cm19a = 1;

This is the exact code from mochad its looking fof VID 0xbc7 and PID 0x00001 or 0x0002. Here are some of the things you can look at:

  1. your VID/PID doesn’t match what you are seeing in lsusb, could be a newer version of CIM 15A. In this case find mochad.c in the mochad sources, change VID/PID to match yours and build mochad again
  2. Mochad is only works with libusb-1.0-0 I haven’t had success with using a newer version.
  3. It may be privilege issue - try running as root.

Hopefully you downloaded mochad from sourceforge and built it yourself according to the instructions above - there are some weird variations of mochad floating in the wild.

Once you get past this problem don’t forget to change the /etc/udev/rules.d/91-usb-x10-controllers.rules files and make sure the path to mochad is correct in it. This is a well known problem, but this doesn’t affect you since you are running mochad manually - see reply number 75 Plugin for cm15a/cm19a X10 Controllers /w Mochad Linux Daemon (full send/recv)

  1. Not sure how I would do this could you give me some more detailed instructions.
  2. I installed libusb-1.0-0-dev. Should I install another one too?
  3. I ran it in sudo mode? is this enough or is there something else I should do?

What I was asking was if the ID shown in lsusb matched - notice that in your earlier message you put the lsub output and it matches - nothing more to do here

Nope you are good. Everything looks good.

This may be a silly question, but did you try out any other program like heyu etc that may be using CM15a. Or maybe another instance of mochad running. I tried running another instance of mochad while one instance is running and I get the same error.

This makes me think you already have mochad running, if you don’t have another app using CM15A. Try ‘ps ax | grep mochad’ and see if there is an instance already running. The installer puts in a line for hot-plugging. If you rebooted etc, mochad may have launched.

if mochad is running you can connect to it by running echo “pl a1 on” | nc localhost 1099 etc or just nc localhost 1099 will start an interactive mochad session and you type commands like “pl a1 on” etc - it doesn’t have a prompt but you should see whatever you type

I got this

238 ? Ssl 0:00 /usr/local/bin/mochad
712 pts/0 S+ 0:00 grep --color=auto mochad

Then tried the next step you said and it works!

I guess it was always running in the background.

LOL - funny how that works sometimes

Now I have another issue I’m running

sudo systemctl start habridge

and can’t connect to it on my laptop through my browser. I’ve tried various ports, although I don’t think I have anything else running on the pi. I did put all of my habridge files in a folder on the desktop directory on the pi, but I changed the 2 file paths in the habridge.service file so it should be good.

any other ideas why it isn’t connecting?

is there supposed to be a habridge.config file in the data directory as it shows in the service file? I don’t see the config file when i do the ls command in the data folder.

edit 2: also getting this error

Failed to start home-pi-habridge.mount: Unit home-pi-habridge.mount not found.

Since systemctl is failing to load the service its not running, so you wont find it

  • do you have a web server on pi at port 80? can you try to navigate to http://IP_ADDRESS_PI what happens?
  • if you have something else answering on http://IP_ADDRESS_PI on the browser, you will need to modify the port in the config file. make sure you pick a free port, easiest way to check is go to http://IP_ADDRESS_PI:PORT - pick any 4-5 digit number, 8080 8090 etc are popular.

To test run the Exec line from the config manually as root - using sudo
ExecStart=/usr/bin/java -jar -Dserver.port=8080 -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-4.5.6.jar

this will run it on port 8080 if 8080 has a conflict (see how to check above) then pick another port

Thanks for that - exactly what I was looking for. I found one in these forums but it looked like whoever was doing it couldn’t get it working.