Sample .xtendrc file


# $Id: sample-xtendrc,v 2.4 1998-04-06 00:48:42-04 dshaw Exp $
#
# This is the configuration file for Xtend, the X10 Daemon.
# Xtend is Copyright 1998 David Shaw <dshaw@jabberwocky.com>

# Everything except the shell commands (see below) are case insensitive
# PORT == Port == PoRt

# This is a comment
# Use \# to specify a literal #
# Use \\ to specify a literal \

# This specifies what shell will be used to run your commands.
# If you don't specify one, it defaults to $SHELL, or if
# that's undefined, /bin/sh

# Shell /bin/bash

# These specify where we're getting the data from.
# 'Port' is, well, a serial port.  Something like /dev/ttyS0
# 'File' is a spool file like heyu(1) generates.
# Obviously, you'll need one of these defined, but not both.

# File /var/tmp/heyu.out

Port /dev/ttyS0

# 'Lockdir' specifies where the normal UUCP-style lock file is generated.
# This defaults to whatever was compiled into the program (probably
# something like /var/lock or /var/uucp/locks) and should probably be
# left alone as the default.

# Lockdir /var/tmp

# 'Appliance' specifies which units are appliances.  This is only used for
# the monitoring system that delivers information on what is on and off to
# the commands that are run (i.e. it doesn't affect which commands are run)
# You can have more than one line for this, if necessary.

# Appliance A1 B8 P12
# Appliance C11 D9

# 'Statusfile' specifies a file that the system can write the current
# state of all 256 X10 devices into.  Each device has two bytes.  The
# format for the first byte is the same as the environment variables
# (see below).  The second byte is reserved and is zero in this version.
# There is a sample program to parse this file in tools/parse-status

Statusfile /var/tmp/x10-status

# these are the actual commands to run.  Each line is of the form
# <address> <X10 command> <shell command>
# <address> is the X10 address, A1 through P16.
# <X10 command> is one of:
#	all-off
#	lights-on
#	on
#	off
#	dim
#	bright
# <shell command> is any command line that can be passed to a shell.

# Play a message when we turn this light off
a1 off cat /var/tmp/hello.au > /dev/audio

# Call in to check for mail
a9 on ifup ppp0

# A more complicated one.  This works with heyu.
a2 on cat /var/tmp/a2.au > /dev/audio ; heyu turn a2 off; heyu turn a3 on

# good night and good morning messages
a all-off cat /var/tmp/alloff.au > /dev/audio
a lights-on cat /var/tmp/allon.au > /dev/audio

# Invent lighting "scenes"
b1 dim heyu turn a1 on; sleep 10; heyu turn a1 off; heyu turn a2 on

# Security stuff
d1 on echo "Hey! Someone tripped the motion sensor!" | mail -s "Security" root
d1 off echo "Motion sensor is clear." | mail -s "Security" root

# Conditionals are implemented via environment variables named after
# each X10 unit.  A1 is X10_A1, B7 is X10_B7, etc.
#
# Bit 7 - On (1)/Off (0): Is the unit currently on or off?
#
# Bit 6 - Addressed (1) / Not Addressed (0): When X10 turns a group of
# units on at once, it "addresses" all of them and then sends a command. 
# These are units that are currently addressed.  If an X10 command is sent
# to their house code, they will respond to it. 
#
# Bit 5 - Appliance (1) / Light (0): Is the unit an appliance or a light? 
# This is settable with the "Appliance" keyword. (see above) 
#
# A quick way to check if a unit is "on" is to do something like
# $X10_B4>=128.  If that is true, then unit B4 is on. 

# example conditional:

a16 on [ $(($X10_B1)) -ge 128 ] && echo "Both A16 and B1 are now on"

# the variables are available within a program called from here as well
# this calls the 'status' program included with the Xtend distribution.

a15 on tools/status

# more or less the same thing as a15, except it uses the Statusfile
# we set from above.

a16 on tools/parse-status /var/tmp/x10-status

dshaw@jabberwocky.com

Return to Xtend
Return to Software
Return to Jabberwocky