Install Mochad
Do not install the "latest" mochad package available from Sourceforge as it has
problems in Raspian Jessie. For some reason Sourceforge currently serves mochad
version 0.1.16 (as of 1 Nov 2016) even though version 0.1.17 is available.
The following shows how to install the later version. However you should check
for a newer version here:
https://sourceforge.net/projects/mochad/files/ and adjust the
wget
commands accordingly.
We will check that the Mochad daemon is not running, plug in the CM19A or CM15A into the USB and check that the daemon is then active and issue an 'on' and 'off' commands to an TM751 Wireless Transceiver module at address D1.
Debugging
If something does not work, there are a few things that can be done to pinpoint the cause. This is probably not an exhaustive list.
- The Mochad service is not running,
Verify its status and then restart it.
pi@rpi2b:~ $ sudo systemctl status mochad ● mochad.service - Start mochad service ... Nov 26 11:43:43 rpi2b systemd[1]: Unit mochad.service entered failed state. pi@rpi2b:~ $ sudo systemctl start mochad pi@rpi2b:~ $ sudo systemctl status mochad ● mochad.service - Start mochad service ... Nov 26 11:49:56 rpi2b mochad[6669]: starting Nov 26 11:49:56 rpi2b systemd[1]: Started Start mochad service. Nov 26 11:49:56 rpi2b mochad[6670]: Found CM19A Nov 26 11:49:56 rpi2b mochad[6670]: In endpoint 0x83, Out endpoint 0x04 - The X10 transceiver (TM751 or RR501) relay clicks but the lamp does not turn
on.
- the lamp is not plugged in the transceiver,
- the lamp is turned off,
- the bulb is burned out.
- The X10 transceiver (TM751 or RR501) relay does not click.
- the house code of the transceiver is not 'D',
- the unit code of the RR501 is not '1',
- the CM15A is too far from the X10 transceiver
- if using power line commands with a CM19A then there could be a phase
problem. There is lots of information
on the Web about this vexing problem. I wasted a lot of time because of this,
I was sending
rf
through a CM19A which also repeated them to the power line. At the time, the 220 volt baseboard was on which bridged the two power phases. The RR501 responded to the power line commands so that I did not figure out that the rf on the CM19A was broken!
Install Heyu
Just as there is no direct support for the CM15A/CM19A interfaces in Domoticz, there is none for the CM11A. A "gateway" called heyu can be installed. It is actually a home automation program of its own but limited to the X10 protocol via the CM11A interface.
Installation of Heyu is quite similar to that of Mochad: get the source code, compile it and install the resulting binary.
Hopefully, Heyu is installed correctly. Check by invoking the application's information command and then try to turn a device on and off
Of course X10 commands take some time to travel along the power line. So don't expect instant responses. However what I actually got was something like a three second delay between invoking Heyu and the device reacting. However the program provides an explanation for the excessive delay:
If getting a long delay when switching lights on and off and report of Q: I get the message "RI serial line may be stuck" after a long delay. A: This is a problem with some adapters using an older Prolific chip. The workaround is to put the directive 'CHECK_RI_LINE NO' in your Heyu configuration file.
The proposed solution works. Both the installation script and the information command say where the configuration file is located.
... # HOUSECODE A # A B C D E F G H I J K L M N O P # Workaround for "RI serial line may be stuck" problem with older Prolific chip # based USB-serial adapter: CHECK_RI_LINE NO ...
Note how the first invocation of Heyu started the relay, a service (daemon) that communicates with the CM11A. Whenever a Heyu command is issued, the program starts the relay if it is not already running. It takes a few seconds to start this service. Thus when a first "on" or "off" command is issued after a reboot, there will be a considerable delay before it is executed. It would be better to start the relay during the boot process. This can be done following the advice in X10 with CM11a wiki:
To restart Heyu at 10 minutes before the end of every hour
(because it sometimes fails) and whenever the Rasberry Pi is rebooted, edit the
crontab
file as follows:
nano
which has been used throught this guide.
# For more information see the manual pages of crontab(5) and cron(8) # # m h dom mon dow command 50 * * * * /home/pi/heyu-2.10/heyu start @reboot /home/pi/heyu-2.10/heyu start
I have not found Heyu particularly flaky, but the above advice means that a problem could resolve itself after an hour. This could be very useful when away for an extended period.
A final pointer: remove all timers and macros that could still be stored in the CM11A. I did not do this and for a while I was wondering what was turning on and off some of the living room lights at seemingly random times. It had been a couple of years since I had used the CM11A but still it contained some timers.
Backup
If your gateway is (or gateways are) working, it may be a good idea to backup the SD card. That means copying the content of the SD card to a file image on your desktop computer. In fact, it amounts to performing the initial Debian image installation process in the opposite direction.
The specific instructions for installing the Debian image to an SD card with a Linux desktop also explain how to do the reverse. If you have a Windows or Mac OSX machine, you can hopefully figure out how to reverse the direction of the copy operation. Here are the series of commands used on Linux: