MariusRumpf / node-lifx

Node.js implementation of the LIFX LAN protocol :bulb:
MIT License
144 stars 28 forks source link

Bulb not found #27

Closed ronzelver closed 8 years ago

ronzelver commented 8 years ago

Hi Marius,

When I run the cli.js script, I get the following output:

`Started LIFX listening on 0.0.0.0:56700

{ size: 100, addressable: true, tagged: false, origin: true, protocolVersion: 1024, source: '42524b52', target: 'd073d500ae66', reserved1: , site: 'LIFXV2', ackRequired: false, resRequired: false, sequence: 0, time: , type: 'echoResponse', reserved2: , payload: 'LIFX���7��=\u0014' } ' from 192.168.1.158' { size: 38, addressable: true, tagged: false, origin: true, protocolVersion: 1024, source: '42524b52', target: 'd073d500ae66', reserved1: , site: 'LIFXV2', ackRequired: false, resRequired: false, sequence: 0, time: , type: 'stateTemperature', reserved2: , temperature: 3800 } ' from 192.168.1.158' { size: 40, addressable: true, tagged: false, origin: true, protocolVersion: 1024, source: '42524b52', target: 'd073d500ae66', reserved1: , site: 'LIFXV2', ackRequired: false, resRequired: false, sequence: 0, time: , type: 406, reserved2: } ' from 192.168.1.158`

MariusRumpf commented 8 years ago

@DaIgeb reported similar problems in PR #25. Maybe a wrong broadcast address is used by the library, which can happen on windows he says. I will take a look at providing this by hand.

MariusRumpf commented 8 years ago

Please try to update to ^0.5.0 and set an explicit broadcast address.

client.init({
    broadcast: '255.255.255.255'
}); 
ronzelver commented 8 years ago

I've installed 0.5.1 and when I run cli.js I now get the following response with or without the explicit broadcast address in the client.init() call (it doesn't seem to take it?!): LIFX Client UDP error Trace: { [Error: bind EADDRINUSE 0.0.0.0:56700] code: 'EADDRINUSE', errno: 'EADDRINUSE', syscall: 'bind', address: '0.0.0.0', port: 56700 } at Client.<anonymous> (/root/node_modules/node-lifx/lib/lifx/client.js:145:13) at emitOne (events.js:90:13) at Socket.emit (events.js:182:7) at dgram.js:215:14 at _combinedTickCallback (node.js:380:13) at process._tickCallback (node.js:401:11) at Function.Module.runMain (module.js:449:11) at startup (node.js:141:18) at node.js:933:3 LIFX error: Error: bind EADDRINUSE 0.0.0.0:56700 at Object.exports._errnoException (util.js:856:11) at exports._exceptionWithHostPort (util.js:879:20) at dgram.js:214:18 at _combinedTickCallback (node.js:380:13) at process._tickCallback (node.js:401:11) at Function.Module.runMain (module.js:449:11) at startup (node.js:141:18) at node.js:933:3

MariusRumpf commented 8 years ago

You get this error if there is already an application running on the same port. Check that you quit all previous instances you ran.

ronzelver commented 8 years ago

Ok, I still had homebridge running. Now I get the following response: `[root@saclnas04 ~/node_modules/node-lifx]# node cli.js Started LIFX listening on 0.0.0.0:56700

{ size: 36, addressable: true, tagged: true, origin: false, protocolVersion: 1024, source: 'eb3e05a2', target: '000000000000', reserved1: <Buffer 00 00>, site: '', ackRequired: false, resRequired: true, sequence: 0, time: <Buffer 00 00 00 00 00 00 00 00>, type: 'getGroup', reserved2: <Buffer 00 00> } ' from 192.168.1.185' { size: 36, addressable: true, tagged: true, origin: false, protocolVersion: 1024, source: 'eb3e05a2', target: '000000000000', reserved1: <Buffer 00 00>, site: '', ackRequired: false, resRequired: true, sequence: 0, time: <Buffer 00 00 00 00 00 00 00 00>, type: 'getLocation', reserved2: <Buffer 00 00> } ' from 192.168.1.185' { size: 36, addressable: true, tagged: true, origin: false, protocolVersion: 1024, source: 'eb3e05a2', target: '000000000000', reserved1: <Buffer 00 00>, site: '', ackRequired: false, resRequired: true, sequence: 0, time: <Buffer 00 00 00 00 00 00 00 00>, type: 'getOwner', reserved2: <Buffer 00 00> } ' from 192.168.1.185'`

ronzelver commented 8 years ago

Problem solved with broadcast address 192.168.1.255

MariusRumpf commented 8 years ago

Perfect