Node.js example to use a RFXCOM to operate a 433MHz fireworks system.
Protocol supported: Lighting4
npm i github:Jorand/rfxcom-fireworks --save
Use the cmd line ls /dev/tty.* in a terminal to find the port of your RFXCOM.
var rfxcom = require('rfxcom-fireworks');
var rfxtrx = new rfxcom.RfxCom("/dev/ttyUSB0", {debug: true}),
fireworks = new rfxcom.Lighting4_fireworks(rfxtrx, rfxcom.lighting4.PT2262);
rfxtrx.on("lighting4", function (evt) {
console.log("lighting4 data in:", evt);
});
rfxtrx.initialise(function () {
console.log("Device initialised");
/* Fire a specific line in one area */
fireworks.fire(1, 1, function(err, response, cmdId) {
console.log("Transmit OK", err, response, cmdId);
});
/* Fire every line in one area one by one */
fireworks.rapidFire(1);
/* Fire every line in one area at the same time */
fireworks.allFire(1);
});
- macOs Catalina 10.15.2
- RFXCOM (RFXtrx433XL)
- node v12.13.0
npm i
node example-webserver.js or npm start
To understand the data protocol i listen the remote data.
Some examples:
0xF701B1fire line 1 in area 10xF701BEall Fire area 10xF701BFrapid Fire area 1
Packet:
0xF7never change01area 1 to 99 (maybe more)Bnever change1line 1 to 12 in Hexadecimal (1,2,3,4,5,6,7,8,9,A,B,C) or all (E) or rapid all (F)
use a RFXCOM to operate a 433MHz scs sentinel HCN0018 control sockets system.
il y a conflit de protocole! elles sont reconnu en PT2262, c'est le protocole lighting4 (à activer) il rentre en conflit (juste pour ces prises!) avec le protocole ARC, il faut le désactiver.
in node_modules/rfxcom
> npm run find-rfxcom
> npm run set-protocols -- --disable ARC --save /dev/tty.usbserial-DO3O5EMF
var rfxcom = require('rfxcom-fireworks');
var rfxtrx = new rfxcom.RfxCom("/dev/ttyUSB0", {debug: true}),
light = new rfxcom.Lighting4_scs_HCN0018(rfxtrx, rfxcom.lighting4.PT2262);
rfxtrx.on("lighting4", function (evt) {
console.log("lighting4 data in:", evt);
});
rfxtrx.initialise(function () {
console.log("Device initialised");
/* Switch On a specific socket */
light.switchOn(1, (err, response, cmdId) => {
console.log("Transmit OK", err, response, cmdId);
});
/* Switch Off a specific socket */
light.switchOff(2, (err, response, cmdId) => {
console.log("Transmit OK", err, response, cmdId);
});
/* Switch On all sockets */
light.switchAllOn();
/* Switch Off all sockets */
light.switchAllOff();
});
To understand the data protocol i listen the remote data.
Some examples (maybe different on another set of sockets):
-
0x455533ON 1 -
0x4555C3ON 2 -
0x455703ON 3 -
0x455D03ON 4 -
0x457503ON 5 -
0x45553COFF 1 -
0x4555CCOFF 2 -
0x45570COFF 3 -
0x455D0COFF 4 -
0x45750COFF 5
Packet:
0x45never change553socket 1,55C2,5703,5D04,75053ON,COFF