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.
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 http://bwssystems.com/#/habridge
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
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 http://sourceforge.net/projects/mochad/files/latest/download 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 :
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.
Step 2: Install HA Bridge
Note:You can find the link to the latest release jar file on this page https://github.com/bwssytems/ha-bridge/releases - 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
Download &Setup HA-Bridge
On your Raspberry Pi, make sure you are in the Pi home folder
Then make an habridge folder:
Now change to the folder and download the latest ha-bridge jar file
Creates the data folder
Now you have to create the systemd service file
Then copy and paste the following in this file
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
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://127.0.0.1:1099/rf 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://127.0.0.1:1099/rf 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