X10 Integration

From SecuriWiki
Revision as of 05:39, 18 October 2014 by matt (Talk | contribs)

Jump to: navigation, search

There is unofficial support for integration with X10 using the mochad package.

Usual disclaimer, use at your own risk. This has been tested on two devices so far to my knowledge, and I am not responsible if it breaks yours.

Installation

You may install it manually by compiling from source, copying over the binaries, etc, or you can use opkg. Links are posted at the end for the manual method, I will simply state the opkg method here.

You can probably do most if not all of this from the OpenWRT web interface, but the method I am describing here requires ssh access and basic shell knowledge.

You may use my host as the package repo for opkg (just please don't hose it ^_^): http://remote.thejanky.org/mirrors/almondplus/packages/ To use this, edit /etc/opkg.conf in your favorite editor and replace the first url, as that one doesn't point anywhere. If you want to use the other unofficial repo, you can switch it back after you do this installation.

Then install some dependencies and mochad.

opkg update
opkg install libusb-1.0 usbutils
opkg install mochad

Udev does not currently have an init script, so we have to make one and start it:

cat <<EOF >/etc/init.d/udev
#!/bin/sh /etc/rc.common
START=38

start() {
    /sbin/udevd --daemon
    /sbin/udevadm trigger
    /sbin/udevadm settle
}
EOF
chmod +x /etc/init.d/udev
/etc/init.d/udev enable
/etc/init.d/udev start

Finally, enable and start mochad:

/etc/init.d/mochad enable
/etc/init.d/mochad start

Using Mochad

To interact with mochad directly, you send commands via TCP on port 1099. The commands are of the form:

SYSTEM DEVICE COMMAND [PARAMETERS]

Systems

  • AP - Almond Plus controlled devices
  • RF - X10 RF module
  • PL - X10 Powerline module
  • LL - LimitlessLED module

Devices

All devices for each system should be supported.

  • AP - Device id (numerical, 1, 2 ...)
  • RF - X10 Device specification, House Code & Unit Code (e.g. A4, C6)
  • PL - X10 Device specification, House Code & Unit Code (e.g. A4, C6)
  • LL - LimitlessLED group number (1-3)

Commands

To see your current device list with device IDs, look at /DeviceList.xml on your A+.

Example Commands

# Turn A+ device 1 on
echo "AP 1 on" | nc localhost 1099
# Turn A+ device 2 off
echo "AP 2 off" | nc localhost 1099
# Get switch status of A+ device 1 (ugly, I know)
echo "AP 1 get_val 1" | nc localhost 1099

Controlling Almond+ using X10 RF Controllers

If you want to be able to control LimitlessLED or Almond+ devices using X10 RF Controllers, you will need to modify the /etc/mochad.conf. This file specifies mappings from X10 device codes to Almond+ device and LLED group IDs.

To see your current device list with device IDs, look at /DeviceList.xml on your A+.

Related forum topics: http://forum.securifi.com/index.php/topic,1913.0.html http://forum.securifi.com/index.php/topic,615.msg7006.html#msg7006