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.
Summary
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.
Requirements
-
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.
https://bfocht.github.io/mochad/
https://bfocht.github.io/mochad/mochad_reference.html -
HA Bridge BWS Systems
Home automation bridge that emulates a Philips Hue light system and can control other systems including mooched using tcp interface.
Setup
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 Download mochad
$ 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 1099At 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 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
wget https://github.com/bwssytems/ha-bridge/releases/download/v4.5.6/ha-bridge-4.5.6.jar -
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
[Unit]
Description=HA Bridge
Wants=network.target
After=network.target[Service]
Type=simple
ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-4.5.6.jar[Install]
WantedBy=multi-user.targetNow, 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:
http://[your-ip-address]:80If 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
https://support.smartthings.com/hc/en-us/articles/200848024-How-to-connect-Philips-Hue-devices
https://support.smartthings.com/hc/en-us/articles/200848024-How-to-connect-Philips-Hue-devices