X10 Home Automation Server using Node.JS and a INSTEON PowerLinc Modem.
JavaScript
Latest commit 17e066c Dec 9, 2015 @eaconner eaconner Update package.json
Permalink
Failed to load latest commit information.
lib
LICENSE
README.md
X10-Remote.js
package.json

README.md

X10-Remote.js

This node application provides a web application that sends X10 commands to a INSTEON PowerLinc Modem (PLM) (2413U for USB, 2413S for Serial) available from: http://www.smarthome.com or http://amazon.com

Install Dependencies

npm install

Configuration

There are some customization parameters that you can change in X10-Remote.js to make the program work in your environment.

API_KEY

var API_KEY = 'changeMe';

The API_KEY is an authentication token to provide a simplistic authenticated web request. The web requests will require inclusion of the query parameter apiKey=[value]. You should set the value to secret token.

SERIAL_PORT_NAME

var SERIAL_PORT_NAME = '/dev/ttyUSB0';

The serial port name should be set the value to communicate with the PLM. The USB PLM can use the FTDI drivers built in to modern Linux kernels. You should be able to plug in the USB PLM and the Linux kernel will create a device. The device will have a name like /dev/tty.usbserial-A901M8OI. You may be able to use dmsg to see log messages describing the actions taken by the Linux kernel to create the device when the USB PLM is plug in to a USB port.

MODULES

// Add X10 Modules to this list. The index number must be unique.
// Name: Module name to display in the web interface.
// House: X10 Module House Code
// Unit: X10 Module Unit Code
var MODULES = {
    0: {name:'Livingroom Lamp', house:'A', unit:'1'},
    1: {name:'Bedroom Lamp', house:'B', unit:'2'},
    2: {name:'Kitchen Light', house:'C', unit:'3',},
    3: {name:'Porch Light', house:'D', unit:'4'},
    4: {name:'Garage Door', house:'E', unit:'5'},
    5: {name:'Humidifier', house:'F', unit:'6'}
};

The object MODULES lists the X10 Modules that you can control. The X10 Modules should be configured before use with X10-Remote.js. There are some example entries in the code to start from. The index of each device must be unique. If you do add more entries, ensure that each entry except the last end with a comma. The name attribute is the name of the Module displayed in the web interface. The house attribute is the X10 house code of the device and the unit attribute is the unit code of the device. You can typically find and set the address on the device itself.

Running

To run the program:

node X10-Remote.js

This will start a web server listening on all IP address on port 8888. It will also open the serial port to communicate with the PLM. Use a web browser to access the web interface at:

localhost:8888/?apiKey=changeme

If all of the configuration is correct, you should see a screen listing each named device with On and Off buttons next to each device name and All On and All Off buttons at the bottom. You can click On, Off, All On, or All Off and an associated X10 command will be sent from the PLM to the addressed device.