Announcement

Collapse
No announcement yet.

CM15a/CM15Pro Configuring x10 to run as a service in Raspbian Jessie

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CM15a/CM15Pro Configuring x10 to run as a service in Raspbian Jessie

    Its possibly been posted here already but I finally managed to setup x10 running correctly as a service on the Raspberry Pi using the CM15a/CM15Pro controller and Mochad. This probably applies to other flavours of linux too.I previously used an entry in the rc.local file but this is no longer working properly in Raspbian Jessie as far as I can see

    Firstly you need to create a Mochad service using the Systemd.

    sudo nano /usr/lib/systemd/system/mochad.service

    Enter the following code in the editor

    [Unit]
    Description=Mochad X10 Daemon
    Requires=systemd-udevd.service
    After=systemd-udevd.service

    [Service]
    Type=forking
    GuessMainPID=yes
    ExecStart=/usr/bin/mochad
    Restart=on-abort

    [Install]
    WantedBy=multi-user.target

    Save this file. Now change the udev rule to start the mochad service instead of trying to start the mochad process directly.

    SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0bc7", ATTR{idProduct}=="0001", RUN+="/bin/systemctl --no-block start moch$
    SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0bc7", ATTR{idProduct}=="0002", RUN+="/bin/systemctl --no-block start moch$

    Save this file. Now you need to enable the new Mochad service just once to have it start on every reboot.

    sudo systemctl enable mochad.service

    That should keep the Mochad service running on the Raspberry Pi without stopping.

    I hope this is of help to anyone.
    Last edited by concordseer; September 30th, 2017, 11:54 AM. Reason: Typo
Working...
X