Mochad_dispatch installation on Hassbian

I have hass up and running on my RPi3B via the Hassbian image. I use X10 primarily as I am moving from using Active Home Pro (ages ago) and HomeGenie (currently). I am using a CM15A as the interface which works correctly with Mochad. I confirmed that things work with PLC (send/receive) and RF (send). What I’m trying to configure is RF receive for both standard commands and possibly security commands. I know HeyU can accomplish this but it is not compatible with my controller. I’ve seen Mochad_dispatch mentioned but I can’t get it to install on my system.

The install should proceed when using the provided install command:
pi@hassbian:~/mochad_dispatch $ sudo python install
Traceback (most recent call last):
File “”, line 1, in
from setuptools import setup
ImportError: No module named setuptools

I installed setuptools:
sudo pip3 install -U pip setuptools

But I still get the same error. I saw another thread mentioning this but no resolution. Is there another way to get mochad_dispatch installed or another approach that is available? The next best thing I’ve seen is using a command to forward to MQTT from the command line but I don’t believe it will work in all cases (could be wrong).
nc -d localhost 1099 | /usr/bin/awk -W interactive ' /HouseUnit:/ && /Func:/ { system("mosquitto_pub -q 1 -t /X10/"$6" -m "$8) } ' &

Does mochad use python 3 or python 2? Try installing with pip instead of pip3

Mochad seems to work fine as is. Do you mean installing mochad_dispatch with Python2? I tried “pip2” command but apparently I don’t have Python2 installed. I can install it, but I would appreciate clarification on the suggestion so I don’t take steps backwards if possible.

I see that Python 2 is installed with Hassbian and the correct line would be pip rather than pip3. I don’t believe that will help as it didn’t run when I tried it.

Is there any reason the PyMochad tool couldn’t be forked to read the RF and security codes as well?

I’m hoping someone else can provide some feedback. I am not having any luck getting mochad_dispatch running and it appears that is necessary in order to use RF on HA. I thought there was a way to use some redirection with the nc output of mochad but that didn’t seem to work for me either.

/bin/nc -d localhost 1099 | /usr/bin/awk -W interactive ' /Rx RF HouseUnit:/ && /Func:/ { system("mosquitto_pub -q 1 -t /X10/"$6" -m "$8) } ' &

just use

nc localhost 1099

and see if you get any traffic.

Mochad does work. What does not seem to work is mochad_dispatch which is needed for rf.

I tabled this for a while but just found a topic on another forum (unrelated to HA or mochad) that suggested my command may be firing python3 instead of python2. If so, and the setup file doesn’t work on python3, I may have to run with “python2” instead of just “python”. Will update if this works.

I think I got it installed. I took a long time off looking at other things, but it looks like I was able to get it going by using python3:

sudo python3 install

It looks like it may not have a python2 installer? Whatever…

Did you use the Python virtual installer option.

I’m running Haspbian and just used the command above. The program seems to run as the commands give no errors, bUT so far I’m not seeing any RF traffic from my HR12A. I read that mochad_dispatch may only transmit X10 security RF, so I’m not all that surprised. If I’m going to use hass as my main HA software, I’ll need to get X10 RF somehow though.

I didn’t try too hard to get Mochad working with HA. I went the Heyu route and it’s working flawlessly. It’s something I’d like to revisit at some stage.

I’m working in the HA venv as it’s easier to manage other services I use that are Python developed but using a different Python version and are feeding into HA.

I use a CM15A as my controller which is not supported by Heyu. I could switch to a CM11A which I have a couple of. However, that’s PLC only and doesn’t address the RF issue. I could add a CM15A if I had one, but at that point I’d rather get a w800 or similar as it’s way more capable.