Minerva
Linux Home Automation for the Masses

Marple stands for Minerva Appliance Routing & ProtocoL Engine. This is a mechanism whereby you can control a TV card, media player, etc on one machine while utilizing an interface on another. This interface might be through any of the standard conduits, such as command line, web interface, or RF Cosmic.

Marple was introduced in Minerva version 2.2.0.

Marple utilizes a globally accessible list of devices and address on one central machine, along with the protocols available to control them. The devices do not need to know about which protocol, or device, is used, so if the global list specifies a CD player on machine 192.168.1.3 then, provided that machine agrees to let its CD player get used, you can send commands via Marple.

Currently Marple supports direct device control with SOAP packets. XAP/XPL and upnp is planned for the future.

Workings

The first file in which Marple looks to determine the address of the device is minerva/etc/devices. There is one directory for each device, e.g. cdplayer, x10, and so on. In each this directory is a file called devlist which is formatted thus:

localhost dev   /dev/dsp        -       -
default   dev   /dev/dsp        -       -
bedroom   soap    192.168.1.123   19781   localhost
The columns are, in order:
  1. The device name, as used in cdplayer bedroom play 1
  2. Protocol type. Currently may be 'dev' or 'soap'.
  3. If the protocol is 'dev', then this represents a Linux-style style on the lo cal machine. If it's 'soap', then it specifics the IP address of the machine to talk to.
  4. The port number associated with the IP address. This is unused for 'dev' protocols.
  5. The device name on the remote device. This is unused for 'dev' protocols.

The currently provided devices are:

  • cdplayer
  • mixer
  • say (also used by announce)
  • wavplayer
  • x10

Marple will look for a matching device name in the first column of the minerva/etc/devices file. If it finds one, it will either:

  1. Call the underlying Bearskin-wrappered program with the device name (if a device is given)
  2. Or send a network packet (e.g. soap) to the machine, for further processing.
In the second case, the same command is sent to the remote machine, with the exception of the device name, which is replaced with that from the fourth column.

If the device name can not be found (on either machine), then the second device list file is used. This file is stored in minerva/house/marple. It has the same format as the above file. If the device still can't be found then the original device name is passed to the bearskin script to see if it can understand it.

Other Transmissions

To take advantage of Marple, and send command using protocols other than SOAP (e.g. upnp) then you simply need toamend the minerva/bin/xmit directory to include a directory name which matches that present in the devlist file.

Inside this directory you need to place a file called cmd. This will be automatically called when a remote request is needed. The first two arguments are the IP and port given in devlist. The remainder represent a command in standard Bearskin format.

Note: if your device is not address by ip/port then you can re-appropriate them to your desires.

Bearskin Compatibility

For Marple to be used by Bearskin, each script needs to feature the following call to finddev:

# Reference usage for finddev...
#
# We've sent (and presumably rcv'd) a request from the finddev call
# Therefore:
# 1. DEVICE is actually the output from that command, which we might
#    need and so reflect to the calling command.
# 2. We exit now with a code of '0'. All Bearskin commands must check
#    for 0. If they receive it, they must also exit immediately.

DEVICE=`$MINBIN/finddev mixer $*`
if [ $? == 0 ]; then
  echo $DEVICE
  exit 0;
fi
All the Bearskin commands provided feature this code.

Caveats

The CD player program cdcd requires $HOME to be set, so rigging up a stand-alone machine to process SOAP requests for the CD player need an extra line of code.

Multi-room support

By Abstracting the devices in this way allows you to create a device called 'bedroom'. Each specific device in the bedroom can then be controlled by a different machine, if desired.

Valid HTML 4.01 Transitional