I have some temperature sensors and a Nexa Motion Sensor linked to a Nexa doorbell chime.
The temperature sensors are detected by the sensor node and it works correctly.
The Nexa kit uses the AC protocol which is actioned by the lighting node, even though theres not a light in sight.
I also had a look at the rfx-lights-out node and I must admit I initially struggled with the terminology/format.
the info suggests "type/device address/unit address" , but until I turned the debug node to display the complete msg object of the rfx-lights-in node I was struggling!
I couldn't see how to determine what the unit address would be in my example, the rfxcom npm package appears to use the term unitcode rather that unit address.
(Motion sensor triggered- added console.log lines to npm package to print out)
Received: 0B,11,00,00,00,7C,B5,7A,0A,01,0F,50
PacketTypeHex:17
subtype:AC
seqnbr:0
id: 0x007CB57A
unitcode:10
commandNumber:1
command:On
level:15
0
I also couldn't see how the actual command is given, as the node info doesn't appear to define that its passed by the msg.payload.
However by copying the rfx-lights-in msg format I can now trigger actions when someone approaches my front door,
and also ring my door bell whenever I want ;-)
roll on halloween!
Many thanks!
9 Oct 11:49:58 - [serial] serial port /dev/ttyUSB0 opened at 57600 baud 8N1
Sent : 0D,00,00,00,00,00,00,00,00,00,00,00,00,00
9 Oct 11:49:59 - [mqtt] [5c1a53eb.a3e5ac] connected to broker tcp://192.168.0.22:1883
Sent : 0D,00,00,01,02,00,00,00,00,00,00,00,00,00
Device initialised
Sending ["0B","11","00","02","00","7C","B5","7A","0A","01","0F","00"]
nothing actually works.
More frustratingly, after a pi reboot sometimes the rfxlights-out node will work once and then stop working.
The rfxlights-in and rfx-sensor-in nodes also appear to be affected.
Any ideas? I've reinstalled both the node and you version of the library without any change.
Max
$ sudo node ./rfxrest.js
Lighting4 listening at http://0.0.0.0:8080
[rfxcom] on /dev/ttyUSB0 - Sent : 0D,00,00,00,00,00,00,00,00,00,00,00,00,00
[rfxcom] on /dev/ttyUSB0 - Sent : 0D,00,00,01,02,00,00,00,00,00,00,00,00,00
[rfxcom] on /dev/ttyUSB0 - Received: 0D,01,00,01,02,53,F8,08,00,00,00,01,03,1C
[rfxcom] on /dev/ttyUSB0 - Received: 09,13,00,0C,CB,11,2A,01,7C,70
But,I'm not sure of the syntax for lighting4.
I've tried with a modified version of LightwaveRF (in the REST example on Kevin's wiki)
[extract]
var rfxcom = require('rfxcom'),
restify = require('restify'),
rfxtrx = new rfxcom.RfxCom('/dev/ttyUSB0', {debug: true}),
rfxsubtype = 'PT2262';
myLighting4 = new rfxcom.Lighting4(rfxtrx,rfxsubtype),
server = restify.createServer({
name: 'Lighting4',
version: '0.0.1'
});
server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser());
server.get('/light/:device/:code/:option/', function (req, res, next) {
//var deviceId = req.params.device + '/' + req.params.code,
var deviceId = req.params.device, // ignoring the other parameters (Niall)
statusCode = 200;
switch (req.params.option) {
case 'on':
console.log('Turning on light %s', deviceId);
myLighting4.switchOn(deviceId);
break;
[here's the URL I use ... the other parameters are ignored)
http://192.168.1.103:8080/light/0x0913000CCB112A017C70/1/on
Turning on light 0x0913000CCB112A017C70
But not working unfortunately.
Would appreciate any tips
(or a working example of lighting4).
Thanks.
Best regards,
Niall.