rfxcom / node-rfxcom

Node.js client for talking to an RFXtrx433 device
MIT License
61 stars 45 forks source link

Issue running LightwaveRF example #15

Closed njh closed 10 years ago

njh commented 10 years ago

Hello,

I have been trying to try the LightwaveRF example, from the README:

var rfxcom = require('rfxcom');
var rfxtrx = new rfxcom.RfxCom("/dev/ttyUSB0", {debug: true}),
        lightwaverf = new rfxcom.Lighting5(rfxtrx, rfxcom.lighting5.LIGHTWAVERF);

    lightwaverf.switchOn("0xF09AC8/1");

But couldn't get it to work:

/tmp $ node test-lightwaverf.js 

/private/tmp/node_modules/rfxcom/lib/lighting5.js:46
    self.rfxcom.serialport.write(buffer, function(err, response) {
                           ^
TypeError: Cannot call method 'write' of undefined
    at Lighting5._sendCommand (/private/tmp/node_modules/rfxcom/lib/lighting5.js:46:28)
    at Lighting5.switchOn (/private/tmp/node_modules/rfxcom/lib/lighting5.js:77:17)
    at Object.<anonymous> (/private/tmp/test-lightwaverf.js:5:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

Does rfxtrx.initialise need to be called somewhere?

Sorry for the dumb question but trying to work out what the minimum code required is.

bigkevmcd commented 10 years ago

Sorry, I see how the example is confusing, and I'll fix that, you'll want to initialise the rfxcom object you get...

I'll update it to make it more complete than it is just now.

njh commented 10 years ago

Thanks!