Mochad X10 connection refused

I’ve installed the Mochad X10 gateway on my RasPi and the Mochad binding. Created dimmer items to control lights. I am sending X10 powerline commands to a CM15A device connected via USB to my RasPi. All works fine and I can control the lights. Unfortunately, this only lasts a few minutes. Then the connection drops.

Has anyone else experienced this issue? I assume it is possible that the the Mochad gateway is hanging or crashing . . .

Openhab log:

2017-11-16 20:20:57.664 [ERROR] [.mochadx10.internal.MochadX10Binding] - Received a “null” message
2017-11-16 20:21:17.694 [ERROR] [.mochadx10.internal.MochadX10Binding] - IOException: Connection refused (Connection refused) while trying to connect to Mochad X10 host: 127.0.0.1:1099
2017-11-16 20:21:22.956 [ERROR] [.mochadx10.internal.MochadX10Binding] - IOException: Connection refused (Connection refused) while trying to connect to Mochad X10 host: 127.0.0.1:1099
2017-11-16 20:21:22.966 [ERROR] [.mochadx10.internal.MochadX10Binding] - IOException: Socket closed while trying to send a command to Mochad X10 host: 127.0.0.1:1099

I believe this is caused by an issue with the udev rule as per this link:
https://sourceforge.net/p/mochad/discussion/1320002/thread/1bef8f39/

this worked for me to fix the issue (so far!):

Steps to fix issue:

  1. sudo rm /etc/udev/rules.d/91-usb-x10-controllers.rules
  2. wget https://github.com/petski/mochad/archive/master.tar.gz
  3. tar zxvf master.tar.gz
    3a. cd mochad-master*
  4. ./configure
  5. make
  6. sudo make install

Also, for anyone looking to install the Mochad X10 Gateway, for example via the instructions here, http://x10linux.blogspot.com/2012/08/installing-mochad-on-raspberry-pi.html should be aware that the version returned by GitHub is not the latest version. the latest version is available here: https://sourceforge.net/projects/mochad/files/

Finally, note that if you are using a CM15A device to interface with the powerline, you first have to get a copy of ActiveHome Pro running on a PC, hook the device up to the PC and clear the memory. http://forums.x10.com/index.php?topic=28827.0

Well, I am walking this back. While the issue did go a away for a bit it reappeared and I really cannot get the whole X10 thing to be stable. Again, my setup is running the Mochad gateway on the same raspi as I am running openhabian.

I got a new error today (see below), and I have decided to uninstall the Mochad X10 binding until I have more time to try to figure out what is going in. I am still thinking that the primary issue is the Mochad Gateway, but I cannot verify that.

017-11-21 07:21:59.882 [WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Exception during event dispatch [org.osgi.service.event.Event [topic=openhab/command/OfficeLtsWork2] {bridgemarker=true, item=OfficeLtsWork2, command=100} | {org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler}={event.topics=openhab/command/*, service.pid=org.openhab.mochadx10, component.name=org.openhab.binding.mochadx10, component.id=180, service.id=307, service.bundleid=201, service.scope=bundle} | Bundle(org.openhab.binding.mochadx10_1.10.0 [201])]
java.lang.NullPointerException
at org.openhab.binding.mochadx10.internal.MochadX10Binding.internalReceiveCommand(MochadX10Binding.java:485)[201:org.openhab.binding.mochadx10:1.10.0]
at org.openhab.core.binding.AbstractBinding.receiveCommand(AbstractBinding.java:97)[182:org.openhab.core.compat1x:2.1.0]
at org.openhab.core.events.AbstractEventSubscriber.handleEvent(AbstractEventSubscriber.java:45)[182:org.openhab.core.compat1x:2.1.0]
at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415)[6:org.apache.karaf.services.eventadmin:4.0.8]
at org.apache.felix.eventadmin.impl.tasks.HandlerTask.run(HandlerTask.java:90)[6:org.apache.karaf.services.eventadmin:4.0.8]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_152]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_152]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_152