Scott Crevier's X-10 Web Interface allows you to control your home appliances from a web site. You create a simple text file which defines the devices you want to control on the web. The interface then displays a table that allows the user to turn appliances on and off (or dim lights) with a single click.

I have tried to make this as configurable as possible. The image at right shows an example of what your control panel can look like. In this example, the X-10 Web Interface only created the part that is gray. The rest is defined by you in standard HTML files.

Usage

This program is a Perl script. Therefore, you must have Perl installed and your web server must be able to execute Perl scripts as CGI programs.

The program accepts commands from the web page and converts them to instructions that are then passed on to the X-10 Communications Bridge. The X-10 Communications Bridge is included with the ActiveHome software package and provides the link between your PC and the computer interface. The ActiveHome application does not need to be running for this to work. Only the Communications Bridge needs to be running.

During the installation of ActiveHome, you are prompted to see if you want the communications link to automatically startup each time you start your computer. I recommend doing this. If you need to do this manually, you may be interested to know that I have an icon in my startup folder with the following command line:

"C:\Program Files\Home Control\X10Comm.exe" HIDE

Also, if you want to run the communications monitor in your system tray, you can add an icon in your startup group with the following command line. Running the communications monitor allows you to start the Active Home application or shutdown the communications link by clicking on the small X-10 icon in the system tray:

"C:\Program Files\Home Control\monitor.exe"

Security

Obviously, when allowing web surfers access to your home appliances, security is a concern. So use common sense when setting this up. If you are familiar with web site administration, you will know that you have many security options available to you that are beyond the scope of this program. However, the X-10 Web Interface does provide a few tools to assist in the effort.

This program allows you to define which of your appliances you want to be controlled on the web. Based on your definitions, this program validates every device and command that it receives before generating the communications link instruction. If something does not check out, no command is sent to your X-10 system.

Also, your X-10 unit codes are never displayed on the web page. Instead, to calculate the unit codes, the program uses a simple mapping that you setup in your configuration file. Now, since this program is freely available, it's not hard for someone to guess the name of your configuration file and then view it in their web browser. If you are concered about that, just change the name of your configuration file and then change the corresponding line in the index.cgi file.

If for any reason you need to shut off the controls temporarily, there is a variable in the configuration file called masterswitch. If this varialbe is NOT set to 'on', then NO commands will be sent to the communications link (though the web page will still function and the user will have no indication that it has been turned off). So use this option as you see fit.

The device definition file allows you to very quickly remove (or add) a device to the web page.

This program also writes every command to a log file. Each log file entry contains the current date and time, the status of the masterswitch, the user's host name (or IP address if the host name is not available), and the actual command sent to the communications link. So, again, use this log file as you see fit.

Price

There is no charge to use this program. However, it would be cool if you send me an e-mail and let me know how this works for you. Providing a link on your web page back to mine would be cool too, but that's not required.

I'm runing ActiveHome v1.41. There is probably a newer version available, but I have not upgraded. So, if you happen to have a newer version, it's possible that it comes with different components.
For example, you might have x10com32.exe instead of x10comm.exe.

The web server and the ActiveHome X-10 Communication Bridge and my web interface must all be running on the same machine. So if you have ActiveHome running on your home PC, then you also need to install a web server and Perl on your home PC. In other words, if you have ActiveHome at home, then it won't work to set this up on a web site hosted by your ISP (it must be installed at home).

Also, if you only have a dialup connection to the internet, and you don't have a static IP address, this stuff will still work; but it will only work while you're online, and the URL used to access it will change each time you connect up.

Create a new directory on your web site called 'X10' (or something like that). This will determine what URL you will use. For example, if your directory is called 'x10', then the URL might be something like this:http://www.your_really_cool_domain_name.com/x10/index.cgi

Download the zip file and unzip it into that new directory. You will need a program like PKUNZIP or WinZip (support for long filenames is not necessary).

Setup the configuration files as explained below.

Fire up the web page and blow up your house!

Configuration

The package consists of the following files:

File

Description

_head.htm_tail.htm

These are HTML files that the program displays above and below the
controls on the web page. By editing these files with your own HTML
code, you can make your web page look exactly like you want.

imgicon.gifimgx.gif

These are just sample image files that are referenced in the
_head.htm file that comes with the package. You can
delete these files if you choose not to use them.

index.cgi

This is the main engine that operates the web page and sends the X-10 commands. You should not need to make any changes in this file.

x10.cfg

This is the main configuration file. You will need to edit this file to customize the program to your liking.
All possible settings are documented in the file itself.

x10.dev

This is where you define all of devices that you want to control on the web page. Each line in
the file represents one device. Comments are allowed in this file and the full syntax is
documented in the file itself.

x10.log

This is where the program writes its log entries. Each log file entry contains the
current date and time, the status of the masterswitch, the user's host name (or IP address
if the host name is not available), and the actual command sent to the communications link.
A setting in the configuration file lets you determine if you want new entries added to the
top or bottom of the file.

NOTE: File locking is not implemented here. Therefore, if your web page is getting a lot of
simultaneous traffic, it is possible that some commands will not appear in the log.

Web Servers and Other Platforms

I have tested this program in Windows 95 using the following web servers:
Apache v1.3b6 &
Xitami v2.3b2

I suspect that with a little effort, you may be able to get this running on other platforms or with other web servers.

To make ".cgi" files run as CGI programs outside of your cgi-bin directory,
add the following directive to your srm.conf file:

AddHandler cgi-script .cgi

To make the web server recognize "index.cgi" files as an index (which allows you to go to a web page
without the filename portion of the URL), you may want to add the following directive to
your srm.conf file:

DirectoryIndex index.htm index.cgi

IMPORTANT: There is a major bug in Apache v1.3b7 where environment variables do not get
passed to CGI scripts. This bug will prevent Scott Crevier's X-10 Web Interface from working so don't use it.

To make ".cgi" files run as CGI programs outside of your cgi-bin directory,
add the following directives to your defaults.cfg file:

[Server]
cgi-url=/
cgi-bin=c:\website

[CGI]
mixed-url=1

To make the web server recognize "index.cgi" files as an index (which allows you to go to a web page
without the filename portion of the URL), you may want to add the following directive to
your defaults.cfg file:

There is not much fancy programming involved in this script. I used the Communication Bridge help file
(which comes installed with Activehome) to get all the required protocols and syntax. My script simply executes the necessary
DOS command lines to issue requests. If you're a Windows programmer, the help file also explains how your program can interface
with the communication bridge via Windows messaging. So, if you are planning to do something similar, I simply recommend that
you read this help file.

Troubleshooting

If you are having troubles getting this to work, consider the following:

Turn your PC on.

Make sure that the ActiveHome application works fine. If that is working, then
that means that your X-10 hardware and the computer interface is also working properly.

Many problems are due to the fact that your web server is not setup right, or that you
are not familiar with its requirements. If this is the case, then you need to either comply
with its current settings or change the settings. If you don't want to mess with your web
server's settings just yet, then perhaps the following info will help you comply with its
current settings.

Some web servers (like Xitami) require that your CGI programs be located under the cgi-bin
directory. This means that if your CGI scripts are not under that directory, they won't run. On my system (Xitami),
I created a subdirectory under my cgi-bin directory called x10.
So the URL that I use is something like:
http://BlahBlahBlah/cgi-bin/x10/

It is also possible that Perl is not installed properly, or that Perl scripts just don't run properly
as CGI programs, or that you're not sure how to make them run. If this is the case, it's best to
troubleshoot this before trying to use my web
interface. To see if this is your problem, try running the following simple CGI script:

When you run the above script, you should just see "Hello world!" in your browser. If you don't,
then the problem is not with my script; instead, you need to work on your Perl/CGI setup. For
this, consult your web server's documentation.

It's possible that the $thispath variable is not getting set properly.
This problem would cause the index.cgi script to be unable to read necessary
files. If this is the case, you can correct this by just hard coding the variable in the
index.cgi script to something like this:$thispath = 'C:\webstuff\cgi-bin\x10';

Make sure that the path to the X-10 Communications Bridge program is set correctly
in the x10.cfg file. You should use the DOS-style pathname and
not the long filenames. I have the following setting in my configuration file:$x10prog = 'C:\progra~1\homeco~1\x10comm.exe';

The x10.cfg configuration file allows you to set certain
parameters to customize your setup. This file uses standard Perl syntax so make sure that
you have not made any typing or syntax errors in there.

Make sure your headfile and tailfile exist as determined in your
x10.cfg configuration file. These settings must be DOS pathnames.

Make sure that the first line in the index.cgi file contains the
correct path to your Perl program. If you did not install Perl in the default location, then you will
need to change this.