This solution allows 2-way communication between SmartThings and X-10 devices using Node Red and Mochad. You can control your X-10 devices from within ST and use various automation solutions within ST. You can also use X-10 remotes and motion sensors to control other ST devices. X-10 equipment is fairly inexpensive and readily available on E-Bay etc.
Almost all X-10 is supported now with the exception of security consoles. Security consoles are X-10 controllers and the SmartThings hub is meant to replace its functions.
I have tried a few different ways of integrating X-10 devices with SmartThings, but every solution required tinkering and making changes outside the ST applications making maintenance difficult. In this solution all X-10 settings and device mappings are done using the SmartThings app. Only a couple of one-time settings need to be made on the Node Red flow.
Update January 11, 2019
This post (174) has a link to an updated setup guide which shows among otther things how to support node-red 0.91 and above thanks to @dgruen45 -
please note: his process while, solves issues for some people also has bits that turn off RF, since he uses WGL RF repeater. If you don’t have a RF repeater or are using an RF-only device such as CM-19A you may want to skip that part. He has highlighted the differences between this guide and his.
Follow 3-4 posts starting at 166 starting here to read about X-10 sync issues and strategies
See these posts (152) if you want to disable the dimming functions
See this post (135) for compatibility with the node-red 0.19 and later
Update March 25, 2018
- Slightly changed the node red flow to accommodate newer style security device addresses - should handle both old and new style
Update March 17, 2018
- Security Remotes, Key Fobs, Panic Buttons, Motion sensors and Door/Windows sensors are supported now
- Quite possible that other obscure sensors such as X-10 moisture sensor will work too
- Security devices have only been tested on mochad, I don’t have the ability to test with heyu, if you are a heyu user and have the equipment to receive security codes, let me and we should be able to get it working
Update March 11, 2018
- Dimming is supported now, see notes below
- Heyu is supported in addition to mochad
Supported Devices and Functionality
X-10 Switches and Modules
X-10 Motion Sensors and Remote buttons - on/off functions supported from devices sending housecode/unitcode on/off commands
X-10 Securitry Remotes, Key fobs, and sensors - please note that X-10 has 2 type of motion sensors MS11A/MS12A/MS14A and MS16A, these transmit on/off using housecode/unitcode like switches.
Then there are MS10A/MS18A security remotes that transmits alerts like the security devices, they don’t have housecode/unitcode buttons, instead they have pinhole type switch to set a random identity code.
Dimmer functions are fully supported for using X-10 remotes controlling SmartThings device
Controlling X-10 dimming functions from SmartThings is an interesting exercise in randomness. It sort of works, the number don’t mean anything its just a slider and up/down arrows. X-10 dimming was designed for physical devices with up/down buttons not deterministic software sending out percentages, its also very variable, same device on different bulbs will exhibit different behaviour.
These instructions are for Raspberry Pi, but they can be easily adapted to any Linux variant
SmartThings hub using a fixed IP address
This can be done by allocating a static IP address in your router. Exact steps will depend on the router.
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.
Heyu and CM11A, CM17A firecracker and other Heyu supported devices (experimental)
Please note that Heyu support is under development - I don’t have a heyu supported device, @JohnnyD69 has been helping me debug this with CM11A, however CM17A has not been tested
Node-RED is a programming tool for wiring together hardware devices, APIs and online services using a browser-based editor. Node Red is very simple to deploy and is very light-weight. Requires minimal effort to setup and run
Please ensure that both Raspberry Pi and the ST hub get fixed IP addresses - most people do this by assigning static addresses for devices on their routers. Both the Pi and ST hub need to know where they are and it needs to stay the same.
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
(Skip this step if you are using heyu - just get that running, however that is done)
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 & Setup Node Red
Install Node Red
Follow the instructions on this page to install Node Red on your Pi https://nodered.org/docs/hardware/raspberrypi
Play around a little bit to get the hangs of the basics
Setup Node Red
Copy the contents of this node red flow to the clipboard if you are using mochad
Use this if flow if you are using heyu - as noted above CM17A firecracker has not been tested
Browse to the Node Red page on your browser
Click on the menu to right and select Import->Clipboard
Copy the contents of the clipboard in the edit box, select ‘new flow’ and import it
Edit the flow and put the hostname for the mochad server, and the file path for the settings file. If you are running node red as user pi and mochad is running on the same machine, you wouldn’t need to make any changes. See the nodes marked with at red box
Next Deploy the flow to activate it.
Step 3: Install the SmartApps and Device Handler in Smertthings
You will need to install the following SmartApps and DTH - make sure you install all 5
The easiest way to get these is to use the github repository by clicking “Settings” when in the Device Handlers or SmartApps segment of the API, and adding a github repository:
Repository Name: SmartThingsX
Otherwise, you can download them from here:
Step 4: SmartApp Setup and Adding Switches, Modules, Remotes and Motion Sensors
Install the SmartApp from your phone
You will need to select the hub and configure IP address and port for the Node Red server - this should be the same IP address and port you use to connect to Node Red on the browser
You can then add X-10 devices on smartthings and set their X-10 addresses.
Once you add a switch you should be able to turn it on and off. You can map remote buttons and motion sensor address to any ST Thing that supports on/off function and control it.
Restart Node Red
Once you setup the SmartApp on the phone, you will need to restart the Node Red flow for it start processing correctly, you can either restart the pi at this point, or restart node red.
*** Main Setup**
*** Switches and Modules**
*** Remotes and Motion Sensors**