X10Server - Control server for the X10 CM11A/CM17A
NEW! - Now supports the X10 CM17A FireCracker!
Control X10 capable devices over a network
using the X10 'ActiveHome'
CM11A or 'FireCracker'
CM17A computer interface module.
General Features:
-
Sends commands to the X10 'ActiveHome'
CM11A or 'FireCracker'
CM17A computer interface module to control X10 capable devices.
-
Supports the most commonly used X10 commands (see list below).
-
Supports the X10 CM11A EEPROM for downloadable events and timer macros.
-
Supports time-of-day loadable CM11A event macros.
-
Can act on received X10 events from other sources and execute its own macros.
-
Accessible from anywhere on the network to allow controlling X10 appliances
(example perl code included. See also X10Client).
-
Sends received/generated X10 events to another client on the netowork for
event logging (example perl code included).
-
Written entirely in Java (v1.1.8 - but
will also run on more recent versions of Java as well, including the latest
J2SE1.4.0).
-
Designed specifically for the Dallas
Semiconductor TINI, but also works on other platforms (eg. Linux, Windows).
TINI Specific Features:
-
Small memory footprint (<35K when compiled for the TINI).
-
Supports resetting the internal date/time clock from a specified time server.
Supported Custom Commands:
-
SetClock [ -t | YYYYMMDDhhmm[ss] ] - (CM11A only) Reset the
internal date/time in the CM11A. (On the TINI, this also resets the system
date/time).
-
ResetEEPROM - (CM11A only) Reload CM11A EEPROM with the currently
valid defined macros.
-
Pause [<seconds>] - Pause for the specified number
of seconds (the default is 1 second).
-
Notify [<message>] - Send "<message>"
to LogHost.
Supported X10 CM11A commands:
-
On <houseCode> <unitCode> [ <unitCode> ...] - Turn 'ON'
specified House/Unit codes.
-
Off <houseCode> <unitCode> [ <unitCode> ...] - Turn 'OFF'
specified House/Unit codes.
-
Dim:<dimValue> <houseCode> <unitCode> [ <unitCode> ...]
- 'DIM' specified House/Unit codes (with specified dim amount).
-
Bright:<brightValue> <houseCode> <unitCode> [ <unitCode>
...] - 'BRIGHT' specified House/Unit codes (with specified bright
amount).
-
PresetDim1 <houseCode> <unitCode> [ <unitCode> ...] - Set
specified House/Unit codes to their 'PRESET_DIM1' value (preset-dim capable
modules only).
-
PresetDim2 <houseCode> <unitCode> [ <unitCode> ...]
- Set specified House/Unit codes to their 'PRESET_DIM1' value (preset-dim
capable modules only).
-
AllLightsOn - Turn 'ON' all light modules.
-
AllLightsOff - Turn 'OFF' all light modules.
-
AllUnitsOff - Turn 'OFF' all lights and appliance modules.
Supported X10 CM17A commands:
On <houseCode> <unitCode> [ <unitCode> ...] - Turn 'ON'
specified House/Unit codes.
Off <houseCode> <unitCode> [ <unitCode> ...] - Turn 'OFF'
specified House/Unit codes.
Dim:<dimValue> <houseCode> <unitCode> [ <unitCode> ...]
- 'DIM' specified House/Unit codes (with specified dim amount).
Bright:<brightValue> <houseCode> <unitCode> [ <unitCode>
...] - 'BRIGHT' specified House/Unit codes (with specified bright
amount).
See the included 'conf/X10.conf' file
for documentation on these commands and example usage.
General Installation Information:
In order to control X10 capable devices, you will first need the X10 'ActiveHome'
CM11A or 'FireCracker'
CM17A computer interface module which can be purchased from X10.
The X10Server was designed specifically for the Dallas
Semiconductor TINI, but should work on any system that can support
the Java CommApi (for
Linux platforms, Java CommApi can be downloaded and installed from
RXTX.org).
The X10Server has been tested on the Dallas
Semiconductor TINI, RedHat Linux
(with the RXTX version of Java CommApi
installed), and Windows/98 (with the Sun Microsystems,
Inc. version of Java
CommApi installed).
General Installation:
-
Install Java JDK v1.2.2
on your platform (JDK versions greater that v1.2.2 should work just fine,
however, if you are planning on eventually building the X10Server for the
TINI, then you should use v1.2.2). Set the environment variable JAVA_HOME
to point to this Java JDK installation.
-
Install the Java CommApi on your platform.. [This is probably the most
complex part to get right, especially on Windows. I've tried to include
as much information as possible here to help you get the Java CommApi installed
on your Windows platform. If you find other information that you
think would be helpful to include here, please let me know]:
-
Windows:
-
Download the file 'javacomm20-win32.zip' (Windows version) from
http://java.sun.com/products/javacomm/
and unzip.
-
The installation documentation accompanying the above Java CommApi was
written for JDK v1.1.x and will likely not work if installed as specified
on JDK versions 1.2.2 or greater. The following has been tested to
work with JDK v1.2.2, J2SE (SDK) v1.3.1, and J2SE (SDK) v1.4.0. [The
directories specified below assume installing on the SDK. If you
are installing the CommApi on the JRE, then the subdirectory "\jre" is
already assumed and should be omitted.]:
-
Copy "win32com.dll" to "%JAVA_HOME%\jre\bin".
-
Copy "javax.comm.properties" to "%JAVA_HOME%\jre\lib".
-
Copy "comm.jar" to "%JAVA_HOME%\jre\lib\ext".
-
If you are installing on Win2K/WinME, you may need to place "%JAVA_HOME%\bin"
before other items in the %PATH% (Since Win2K has its own
'java.exe'). The X10Server has not been tested on Win2K, WinME, or
WinXP (if you try installing on any of these platforms, please let me know
if you run into any specific issues).
-
The Java CommApi is not a supported Sun product. If you are still
having difficulty, here are some other resources/links which may help to
get Java CommApi working on your Windows platform:
-
Linux:
-
Download the file "javax_comm-2_0_2-solsparc.tar.Z" (Solaris Sparc
version) from http://java.sun.com/products/javacomm/,
unzip and extract the file "comm.jar" (this is the only file you
will need from this package).
-
Download the appropriate "rxtx-1.XX.tar.gz" file from http://www.rxtx.org/.
-
Follow the accompanying documentation to make/install the Java CommApi
(you will be asked for the "comm.jar" which you extracted above).
-
Modify 'conf/X10.conf' with your specific
configuration information.
-
Set the 'CommandPort' to the TCP port number you with to have the
X10Server receive commands.
-
Set the 'LogHost' to the host and UDP port number to which X10 log
events will be sent/broadcasted. The host may be a specific
host/ip address, or may indicate a general broadcast address (recommended
when used with the Sharp
Zaurus X10Client) which will allow
any host on the subnet to receive X10 logging events simultaneously.
Note that X10 log events are considered informational only, thus X10 log
events are sent via UDP packets. This means that any client listening
to X10 events isn't guaranteed to receive a specific event. But in
practice few X10 event packets are ever lost.
-
If the X10Server will be installed on the TINI, set the 'TimeServer'
to a host which has the 'daytime' service (port 13) enabled (on Linux,
see '/etc/services' and '/etc/inetd.conf' to enable if
necessary). This time-server will be used to read the Date/Time string
(eg. "Fri Sep 29 02:53:45 2000") from the 'daytime' service. The
'TimeServer' is ignored on non-TINI platforms. The command 'SetClock
-t' on a non-TINI platform will set the CM11A date/time to current
system date/time.
-
Sending the command '!reload' will cause a running X10Server to
reload 'X10.conf' after modifications have been made. (Note: Use
an X10Server client to send the '!reload' command, do not put
the '!reload' command into the 'X10.conf' file.)
-
Starting with a Non-TINI installation (Linux, Windows) is recommended prior
to attempting a TINI installation. A Non-TINI installation (Linux/Windows)
is easier and will familiarize you with the expected behaviour when you
eventually attempt to load the software on the TINI.
Non-TINI Installation:
-
If necessary, (re)build 'X10CM11A.jar', or 'X10CM17A.jar'
(this assumes building in a Linux environment with gnumake installed):
-
Set the environment variable JAVA_HOME to point to a valid Java
JDK installation v1.2.2 (or greater), with Java CommApi installed..
-
CM11A: Run 'make cm11a' to build 'X10CM11A.jar'.
-
CM17A: Run 'make cm17a' to build 'X10CM17A.jar'.
-
Connecting to 'ActiveHome' CM11A:
-
Insert the backup batteries into the X10 CM11A module and plug it into
the wall.
-
Connect the CM11A to your platform using the X10 supplied serial cable.
-
Connecting to 'FireCracker' CM17A:
-
Connect CM17A to the serial port of your computer.
-
Make sure you have an X10 Transceiver Module (such as the TM751) plug into
the house wiring somewhere close by and dialed in to the desired house
code.
-
Modify either 'runX10CM[11/17]A' (Linux), or 'runCM[11/17]A.bat'
(Windows), with the proper platform specific serial port name identifier
to which the CM11A/CM17A is attached. If you don't know the names
of the serial ports that are available on your platform, run the X10Server
without any serial port name specified. A list of available serial
ports will be displayed.
-
Windows serial port names are 'COM1', 'COM2', etc.
-
Linux serial port names are usually '/dev/ttyS0', '/dev/ttyS1',
etc.
-
Start the X10Server with the appropriate 'bin/runCM[11/17]A[.bat]'
script for your platform, or execute the java command from the command
line directly as follows (the commands shown assume starting from the X10Server
directory):
-
Windows: "%JAVA_HOME%"\bin\java -classpath X10CM[11/17].jar
X10.X10Main -f conf\X10.conf <SerialPortName>
-
Linux: $JAVA_HOME/bin/java -classpath X10CM[11/17].jar X10.X10Main
-f conf/X10.conf <SerialPortName>
-
If you receive either of the following 2 error messages, recheck your Java
CommApi installation (if you have multiple JDKs installed on your system,
make sure that the one you are using has the proper Java CommApi files
installed):
-
"No ports found!" likely indicates that either 'javax.comm.properties'
or 'win32com.dll' were not found.
-
"... NoClassDefFoundError: javax/comm/NoSuchPortException" likely
indicates that 'comm.jar' was not found.
TINI Installation: (CM11A only)
-
The Dallas Semiconductor
TINI is a nice platform for a small server application such as this.
The TINI is a small Java computer (roughly 7"x4"x1.5") that can, with the
X10Server software, be in constant communication with the X10 CM11A tranferring
commands and events to and from the network interface. This is what
I've been using for years to control the lights in my house.
-
If necessary, (re)build 'X10.tini' (this assumes building in a
Linux environment with gnumake installed):
-
Download and install the TINI SDK from the Dallas
Semiconductor TINI web site.
-
Set the environment variable TINI_SDK to point to the TINI SDK installation.
-
Set the environment variable JAVA_HOME to point to a valid Java
JDK v1.2 installation.
-
Run 'make tini' to build 'X10.tini' .
-
FTP the 'X10.tini' and 'X10.conf' files to your TINI
platform.
-
Connect the CM11A to the TINI.
-
Insert the backup batteries into the X10 CM11A module and plug it into
the wall.
-
You will need to make a short DB9 "cross-over" serial cable to go between
the X10 supplied serial cable and the TINI (to swap pins 2 & 3).
-
Pins [2,3,5,9] on the male DB9 connector should go to pins [3,2,5,9] on
the female DB9 connector respectively. All other pins should be removed
or disconnected.
-
All parts are readily available from Radio Shack. I used a male DB9
to RJ11 connector and a female DB9 to RJ11 connector, with a short 6" piece
of RJ11 phone line to connect them. No soldering is necessary with
these 'kit' type connectors, just place the pins in the right location
and your done (be aware of any 'cross-over' that may already be present
in the short piece of RJ11 phone line. If you can make one yourself,
make it 'straight through'.).
-
Once assembled, connect the X10 serial cable to this "cross-over" cable,
then connect the "cross-over" cable to the TINI.
-
Note: The X10 CM11A asserts the ring-indicator (pin 9) when sending
polling characters, however the ring-indicator is ignored on the TINI,
so it is not always possible to distinguish a CM11A poll character from
requested data. Special consideration has been attempted in the X10Server
software to try to account for this and handle polling data when received
from the CM11A, however, it's not always perfect.
-
Telnet to the TINI:
-
Make sure the SerialServer is stopped (to release the serial port).
-
Start the X10Server with the command: java X10.tini -f X10.conf
serial0 > null &
-
You should also set the startup script to restart the X10Server (with the
above command) when the TINI is power-cycled (or rebooted).
[See the X10Slush package, if available, for automatically reloading the
X10Server on the TINI on reboot. Thus eliminating the need to telnet
changes in the software or macro file to the TINI.]
Testing
To test the interface, make sure you have started a X10 event logger on
the LogHost and port specified in the 'X10.conf' file.
You can use the perl script 'bin/x10Log' or the Java application
in the
X10Client package to monitor
X10 events.
-
When the X10Server has started (either via 'runX10CM[11/17]A',
or by rebooting the TINI), you should see a series of X10 events listed
by the X10 event logger as the CM11A/CM17A is initialized. If started
on Linux/Windows, you should see additional information displayed on the
terminal from which X10Server was started.
-
Plug in an X10 capable module and set it to respond to A1. Using
the perl script 'bin/x10', or the Java application in the X10Client
package, test the X10Server by sending an 'ON A1' command,
followed by an 'OFF A1' command to see if it responds.
You should also see corresponding X10 events displayed by the X10 event
logger.
Endless Possibilities
The possibilities are endless for controlling various aspects of lighting
and appliances with the X10Server and the proper X10 capable modules.
Here are some ideas for using the X10Server with the proper X10 capable
devices:
-
After a certain time of day (ie. after dark), turn on certain lights in
the house if an outside IR sensor is triggered.
-
Shut off the water if a leak is detected around potential damage areas
such as a water-heater or washing machine.
-
Turn on an outside faucet if the tempurature starts to dip below freezing.
-
Chime an alarm in your kids room weekday mornings at 6:30am to make sure
they get up and ready for school.
-
Turn on the yard lights at 7pm and off at 5am.
-
And the best one of them all: When you try to call home and your phone
is busy because your son has been talking to his girlfriend for hours,
ssh into your home Linux server and start turning all the lights in the
house on and off multiple times. Within less than 60 seconds the
phone line will be clear. 8^)
Links
Questions? Comments? Let me know what
you think! Contact me at: mflynn@usa.net
Copyright (c) 2002 Martin D. Flynn