I've been working on a small application for managing various home automation elements, and part of it includes an RFXtrx433, I've released v0.0.2 of the library to npmjs.org at http://npmjs.org/package/rfxcom for anybody interested.
I'm happy to add further functionality, it's in a very basic state just now, just handling elec2 and lighting5 and security1 messages, but the test infrastructure should make it easy to extend further.
It's hooked up to an express.js application that I will hopefully release in due course.
The API is in a state of flux, but the core events are unlikely to change, the code below is illustrative of use.
Code: Select all
var RfxCom = require('./rfxcom').RfxCom;
var rfxcom = new RfxCom("/dev/ttyUSB0", {debug: true});
rfxcom.on("ready", function() {
console.log("RfxCom ready for further behaviour.");
rfxcom.reset(function() {
rfxcom.delay(500);
rfxcom.flush();
rfxcom.getStatus(function(){
console.log("Status completed.");
});
});
});
/*
* This reports security updates from X10 security devices.
*/
rfxcom.on("security1", function(subtype, id, deviceStatus, battery) {
if (deviceStatus==0x04) {
console.log("Device %s %s detected motion.", subtype, id);
rfxcom.lightOn("0x010203", 1); // This turns on a LightwaveRF light with id 0x010203 & unitcode 1
} else if (deviceStatus==0x05) {
console.log("Device %s %s reported motion stopped.", subtype, id);
rfxcom.lightOff("0x010203", 1); // This turns off a LightwaveRF light with id 0x010203 & unitcode 1
}
});
rfxcom.open();