Skip to content

Instantly share code, notes, and snippets.

@bigkevmcd
Created April 7, 2014 20:20
Show Gist options
  • Select an option

  • Save bigkevmcd/10044564 to your computer and use it in GitHub Desktop.

Select an option

Save bigkevmcd/10044564 to your computer and use it in GitHub Desktop.
var rfxcom = require('./lib');
var rfxtrx = new rfxcom.RfxCom("/dev/tty.usbserial-05VLOAQQ", {debug: true});
rfxtrx.on("receive", function(data) {
console.log(data);
});
rfxtrx.on("elec2", function(evt) {
console.log(evt);
});
rfxtrx.on("status", function (evt) {
console.log("Status message");
console.log("Subtype: " + evt.subtype);
console.log("Sequence number: " + evt.seqnbr);
console.log("Command: " + evt.cmnd);
console.log("Receiver Type: " + evt.receiverType);
console.log("Firmware Version: " + evt.firmwareVersion);
console.log("Enabled Protocols:");
for (var n = 0; n < evt.enabledProtocols.length; n++) {
console.log(" " + evt.enabledProtocols[n]);
}
console.log("");
});
rfxtrx.initialise(function (error) {
if (error) {
throw new Error("Unable to initialise the rfx device");
} else {
console.log("Device initialised");
}
});
@bwired-nl
Copy link
Copy Markdown

This works for me !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment