Mochadx10 changes for OH2

New to OpenHAB and the community. Thank you for all your hard work.

I setup a clean OH2 install and attempted to use the Mochadx10 binding. Debugging turned up two problems. NullPointerException when OH2 attempted to send messages outbound to Mochad, Device not found errors when OH2 attempted to process incoming messages from Mochad.

I implemented similar fixes to the RFXCOM binding:
Changed genericbindingprovider.xml to activate immediately
Changed mochadx10binding.xml to activate immediately

This resolved the errors, and I am having great success with the system. I noted a side effect with the change, OH2 would no longer shut down cleanly.

I traced the problem to the deactivate routine in disconnectFromMochadX10Server() was not returning.
Commenting out this call, solved the shutdown problem. This offends the programmer in me, but lacking a deep understanding of the framework, I am not in a position to pursue the correct way to activate and deactivate the routine. I may continue to look into this, but I will not be able to submit a proper fix any time soon.

If someone wishes to follow through with my rough beginning, I’m happy to consult or test.


Thanks for sharing your findings @scottr. I’m planning on moving my system to OH2 in the near future and the MochadX10 compatibility was one of those making me hold back.

I assume you are use the 1.9 binding? Did you push your changes back or are they just on your own set up?

I used the 1.9 binding. Did not push back changes, sort of a neophyte with the tools, and also not entirely proud of the work, since my fix took away the proper unloading of the binding. I can probably share the files I changed pretty easily.

Unfortunately, I really can not continue to investigate. I picked up an Insteon PLM to add some Insteon switches to my mix, and found it could do all the x10 functions I needed as well as the MochadX10 binding, with less moving parts. So my CM15a has now been relegated to nothing more than an RF remote receiver.

Let me know if I can help you out with my edited versions of the files.


Great that you’ve got a working solution for yourself. Thanks for the offer of the edited files but I should be ok to compile the changes - I had a quick look yesterday (I’ll come back to you if I run into any difficulties :slightly_smiling: ).

Any updates to a committed solution? Also to install the mochad binding in OH2, are guys using the addons.cfg to add mochadx10 as a binding parameter?

Yes, I pushed the changes a couple of weeks back.

So your change was merged with OH. How to know that is flowing to the offline OH2 zip?

EDIT: The latest OH2 binaries (below) don’t seem to have these changes. I inspected the mochad jar file and the two xml’s are left unchanged.

It is an OH1 binding, not OH2.

So why is the title of the thread addressed for OH2?

It is an OH1 binding being used in OH2 via the compatibility layer - i.e. it is not a native OH2 binding. The github link you were looking at is for native OH2 bindings.

Please excuse my ignorance as I’m new to the OH world. I have OH 1.8.3 working but am looking to move to OH2. I’m trying to get the Mochadx10 binding working on OH2 and am running into problems. Can someone tell me if they have this working? Do I need to download a modified jar file or is the problem with Mochadx10 in the core of OH2 and the latest beta release does not address it?

I am using it daily on OH2 without any issues. You need to ensure you have the compatibility layer installed first. After that, the Mochad binding should work fine.

What version of the binding are you using?

Version 1.9

How about adding it to the distro then?

I tried earlier, but I may have broken something in my IDE as I’m now getting the following errors when trying to compile the binding with the karaf binding.xml (error occurs with and without the new binding.xml file):

Processing inclusion from feature org.eclipse.pde.container.feature: Bundle org.openhab.binding.mochadx10_1.9.0.qualifier failed to resolve.: Unsatisfied import package org.apache.commons.io_0.0.0. Unsatisfied import package org.apache.commons.lang_0.0.0. Unsatisfied import package org.osgi.framework_0.0.0. Unsatisfied import package org.osgi.service.cm_0.0.0. Unsatisfied import package org.slf4j_0.0.0. Host plug-in JavaSE_0.0.0 has not been found.

I see the entries in the MANIFEST.MF but am unsure as to how to take it forward.

As I’m not very familiar with Eclipse, can you point me in the right direction?


Just do step (1) and leave out step (2) - then all you need is a text editor for adding the binding as a Karaf feature to the build.

Thanks and done.