X10 CM15A On Hassio

Noob and learning a lot about Hassio. Trying to understand what it takes, or even if it’s possible, to get X10 using a CM15A working on Hassio. From everything I’ve read it looks like using Mochad is required. I’ve followed the limited information on Home Assistant web page that discusses Mochad and have modified my configuration.yaml file to include:

X-10 Support via Mochad

mochad:
host: localhost
port: 1099

…and

light:

  • platform: mochad
    devices:
    • address: a1
    • address: a9

After making these changes I successfully used the Configuration validation tool. Now I’m not sure where to go from here. Is Mochad support native to Hassio or does it require a custom Add-on? It’s a huge challenge, but if a custom Add-on is what it takes, I’m up for a challenge, Linux is not my strong suite, so it will be exactly that but a good learning experience. I just don’t want to waste a lot of time if I am barking up the wrong tree. Any resources available besides " Tutorial: Making your first add-on" ( https://developers.home-assistant.io/docs/en/hassio_addon_tutorial.html ) that can give me a better understanding of Add-ons? I’m not finding much in the forums about X10 and Machad, and nothing that is recent.

UPDATE 5/21/19:
I’ve spent a bit of time over the last several days devouring whatever I could find in various forums. Still not making much progress, but here is where things stand.

Looks like I should be using a Dockerized version of Mochad in a custom add-on. I found such a resource on GitHub and have tried following the directions in the readme file. My Dockerfile contains the following:

FROM alpine

MAINTAINER Jay Shridharani <[[email protected]](mailto:[email protected])>

RUN apk add --update --no-cache gcc g++ cmake make wget libusb-dev && \

     mkdir /build && cd /build && \

     wget -O mochad.tgz http://sourceforge.net/projects/mochad/files/latest/download && \

     tar -xzvf mochad*.t* && \

     cd mochad* && ./configure && make && make install && \

     apk --purge del gcc g++ cmake make wget && \

     rm -rf /var/cache/apk/* /lib/apk/db/*

 CMD ["mochad", "-d"]

When I try and run my Dockerfile I get the following error:

mochad.c:611:failed to initialise libusb -99

My OS is HASSOS running on an a Raspberry Pi 3 b+, so I only have limited access to the OS. I am able to run lsusb which informs me that my device is seen by the OS and is on bus 1:

Bus 001 Device 007: ID 0bc7:0001

The Dockerized version of my application (https://github.com/jshridha/docker-mochad/blob/master/README.md ) has a readme file that states to run the following command:

docker run -d --name=mochad --device "/dev/bus/usb/001" jshridha/mochad:latest

I can see that the container is built but won’t run and I get the libusb initialization error indicated above. Any ideas how to get past this impasse?

1 Like

Have you a particular reason for running in a docker. I do know that Mochad works fine in a venv setup on the Raspberry Pi.

Once you build and install Mochad and create a systemd service for Mochad you can easily incorporate it into a venv.

Thanks for the reply @ConcordGE. As stated, I’m new to Linux and Hassio has the OS pretty locked down. I’m using a Dockerfile only because it was the only route I could figure based on discussion boards with my limited understanding of Hassio and it’s ability to make use of custom add-ons. I am trying to keep my solution as simple as possible without having to learn too many additional technologies. However if using a virtual environment is the better approach, I will start investigating what it takes to implement this. Any suggestions on where to go to learn about venv and systemd so I can quickly get up to speed?

Seriously it doesn’t get simpler than this. It’s all copy/paste and ensure you copy/paste every line and you’re up and running in a venv

Thanks again for the new direction @ConcordGE. Before I ditch Hass.io to go the Raspbian Lite and Home Assistant path, my ultimate goal is to get HA running to support ZigBee, Zwave and X10 simultaneously along with a nice Lovelace UI. Is this going to be doable with Raspian Lite / HA without much more effort than Hass.io? I’m under a time crunch and simply looking for the path of least resistance. :grinning:

If the platform is supported of course. Best to try it and make up your own mind up.

chad01,

Thanks for these posts. I had mochad running for a few days using nc on multiple computers and just couldn’t get my homeassistant config yaml validated. I’m running HA on a VM in a windows 10 htpc. I’m using a spare pi running raspian as my mochad server and that seems to be working. Not the best solution, but maybe an option instead of using docker. It should also let you test standalone from the pi running mochad by using the nc command. Then add your yaml paste from above and you should be good to go. Only reason I’m not running a pi on hass os, is because I didn’t know how to add mochad on a non-linux os. Good luck.

@chad01 I just found this post of your’s, and was wondering how did you make out with your X10 setup. I have quite few Z10 devices, that I would rather not throw out.