Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

License

NotificationsYou must be signed in to change notification settings

AlanDThiessen/cm11a-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Node.js module for controlling X10 devices through a serial CM11A interface. It allows NodeJe applications to conrol X10 devices through the serial interface of the CM11A, and monitors status of X10 devices.

Installation

npm install cm11a-js

Usage

// Import the moduleconstCM11A=require('cm11a-js');// Create an CM11 objectletcm11=CM11A();// Start the service, connecting to the Serial Portcm11.start('/dev/ttyUSB0');// Issue Commandsletunits=['A1','A2'];cm11.turnOn(units);cm11.dim(units,11);cm11.bright(units,11);cm11.turnOff(units);// Close the connection to the CM11Acm11.stop();

Commands

Start

cm11.start(port);

Opens serial communications with the CM11A on the specified serial port, and begins monitoring for unit status.

  • port is the serial port to open, e.g./dev/ttyUSB0 on Linux, andCOM1 on Windows.

Stop

cm11.stop();

Close serial communications with the CM11A, and stops monitoring device status.

Turn On

cm11.turnOn(addresses);

Turns on the specified unit addresses.

  • addresses is an array of X10 device addresses. e.g. ['A1', 'A3']

Turn Off

cm11.turnOff(addresses);

Turns off the specified unit addresses.

  • addresses is an array of X10 device addresses. e.g. ['A1', 'A3']

Bright

cm11.bright(addresses, level);

Brightens the the specified unit addresses by the specfied level.

  • addresses is an array of X10 device addresses. e.g. ['A1', 'A3']
  • level is a value between 0 and 22, indicating how much to brighten the device. Note: this is a relative value, not an absolute value.

Dim

cm11.dim(addresses, level);

Dims the the specified unit addresses by the specfied level.

  • addresses is an array of X10 device addresses. e.g. ['A1', 'A3']
  • level is a value between 0 and 22, indicating how much to dim the device. Note: this is a relative value, not an absolute value.

setClock

cm11.setClock();

Sets the clock of the CM11A controller to the current time provided by the PC.

status

cm11.status();

Reads the status from the CM11A returns the status through the status callback event below.

Events

Calling modules can subscribe to the following events on cm11a-js interface.

Unit Status

Provides the status of X10 devices when the CM11A detects a change on the power line.

cm11a.on('unitStatus',callback);

When the status of a device changes, the callback function will be called with the following object:

{// An array of unit codes for which status is being reported.units:array,// The X10 Function that was called on the devicex10Function:string,// The level of the function is DIM or BRIGHTlevel:number}

Device Status

Provides the status of the CM11A as read from the device with thestatus() function.

cm11a.on('status',callback);

After the status has been read from the CM11A, the specified callback function will be called with the following object:

See section 9 in theInterface Communication Protocol on theHeyu website for more details.

{// Time since last battery changebatteryTimer:value,// CM11A Firmware RevisionfirmwareRev:value,// An object containing values of the CM11A's clocktime:{// Day of the yeardayOfYear:value,// Hour of the dayhours:value,// Minute of the hourminutes:value,// Second of the minuteseconds:value},// An object containing the status of monitored devicesmonitoredDevices:{// House code being monitoredhouseCode:value,// Currently addressed devicesaddresed:value,// On/Off status of monitored devicesonOffStatus:value,// Dim status of the monitored devicesdimStatus:value},// A bitmask indicating Which day it is (SMTWTFS)dayMask:value}

Close

Notifies the calling software when communications with the CM11A have been closed.

cm11a.on('close',callback);

When the serial port has been closed, the specified callback function will be called with no parameters.

Acknowledgements

Heyu

Kudos to theHeyu project. Heyu provides a complete interface to the CM11A (and other devices). The documentation and research they have done has been priceless! Heyu ran my house for many years!

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp