Giter Site home page Giter Site logo

Comments (3)

ristomatti avatar ristomatti commented on August 11, 2024

I just tried and I got the same error. I then tried running the script with the call to getHardwareVersion commented out which seemed to help. Curiously I then tried once more with `getHardwareVersion´ call included and this time there were no issues. All lights returned the hardware info also.

I haven't experienced this earlier either so it's likely related to some of the recent firmware updates. One reason could be that the lights aren't responding as fast. Could you try a longer response timeout setting on the client if you still get the same error? Just change line 44 of interactive-cli.js to for example:

client.init({ messageHandlerTimeout: 90000 });

If this doesn't help then it could help wrapping the getHardwareVersion to a try catch block and retry a few times.

from node-lifx.

RobinBol avatar RobinBol commented on August 11, 2024

I changed the interative-cli.js to this (using the messageHandlerTimeout of 90000):

client.on('light-new', function(light) {
	console.log('New light found.');
	console.log('ID: ' + light.id);
	console.log('IP: ' + light.address + ':' + light.port);

	light.getState( (err, info) => { // or light.getHardwareVersion
		if (err) {
			console.log('1', err);
			light.getState( (err, info) => { // or light.getHardwareVersion
				if (err) {
					console.log('2', err);
					light.getState( (err, info) => { // or light.getHardwareVersion
						if (err) {
							console.log('3', err);
							throw err;
						} else {
							console.log('Label: ' + info.label);
							console.log('Power:', (info.power === 1) ? 'on' : 'off');
							console.log('Color:', info.color);
						}
					});
				} else {
					console.log('Label: ' + info.label);
					console.log('Power:', (info.power === 1) ? 'on' : 'off');
					console.log('Color:', info.color);
				}
			});
		} else {
			console.log('Label: ' + info.label);
			console.log('Power:', (info.power === 1) ? 'on' : 'off');
			console.log('Color:', info.color);
		}
	});
});

Which results in this:

Keys:
Press 1 to turn the lights on
Press 2 to turn the lights off
Press 3 to turn the lights red
Press 4 to turn the lights green
Press 5 to turn the lights blue
Press 6 to turn the lights a bright bluish white
Press 7 to turn the lights a bright reddish white
Press 8 to show debug messages including network traffic
Press 9 to hide debug messages including network traffic
Press 0 to exit

Started LIFX listening on 0.0.0.0:56700

DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c49465856320000848098952762ce1403000000017cdd0000 from 192.168.1.16
New light found.
ID: d073d501c21b
IP: 192.168.1.16:56700
DEBUG - 29000054f471ca51d073d501c21b00004c49465856320000446bba962762ce1403000000057cdd0000 from 192.168.1.16
DEBUG - 24000014f471ca51d073d501c21b00000000000000000001000000000000000017000000 to 192.168.1.16
DEBUG - 24000014f471ca51d073d501c21b00000000000000000002000000000000000065000000 to 192.168.1.16
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
Light offline. ID:d073d501c21b, IP:192.168.1.16:56700

DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000002000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c49465856320002448de4b23762ce1403000000057cdd0000 from 192.168.1.16
1 [Error: No LIFX response in time]
DEBUG - 24000014f471ca51d073d501c21b00000000000000000003000000000000000065000000 to 192.168.1.16
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c49465856320003043ddbdc3862ce1403000000017cdd0000 from 192.168.1.16
Light back online. ID:d073d501c21b, IP:192.168.1.16:56700

DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
Light offline. ID:d073d501c21b, IP:192.168.1.16:56700

DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000003000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c494658563200030408c2814b62ce1403000000017cdd0000 from 192.168.1.16
Light back online. ID:d073d501c21b, IP:192.168.1.16:56700

2 [Error: No LIFX response in time]
DEBUG - 24000014f471ca51d073d501c21b00000000000000000004000000000000000065000000 to 192.168.1.16
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000004000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c4946585632000484a2daac4c62ce1403000000017cdd0000 from 192.168.1.16
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000004000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c49465856320004446d88d74d62ce1403000000017cdd0000 from 192.168.1.16
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000004000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c49465856320004448cbf024f62ce1403000000017cdd0000 from 192.168.1.16
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000004000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c4946585632000484e4c82d5062ce1403000000017cdd0000 from 192.168.1.16
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000004000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c49465856320004840c3d595162ce1403000000017cdd0000 from 192.168.1.16
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000004000000000000000002000000 to 255.255.255.255
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000004000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c49465856320004440cefa85362ce1403000000017cdd0000 from 192.168.1.16
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000004000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c49465856320004846d35d45462ce1403000000017cdd0000 from 192.168.1.16
DEBUG - 2400003443c4a68600000000000000000000000000000002000000000000000002000000 from 192.168.1.39
DEBUG - 24000034f471ca5100000000000000000000000000000004000000000000000002000000 to 255.255.255.255
DEBUG - 29000054f471ca51d073d501c21b00004c49465856320004c4ce7bff5562ce1403000000017cdd0000 from 192.168.1.16
3 [Error: No LIFX response in time]
/Users/robinbolscher/Development/apps/com.lifx/node_modules/node-lifx/example/example.js:20
                                                        throw err;
                                                        ^

Error: No LIFX response in time
    at Client.<anonymous> (/Users/robinbolscher/Development/apps/com.lifx/node_modules/node-lifx/lib/lifx/client.js:368:19)
    at Array.forEach (native)
    at Client.processMessageHandlers (/Users/robinbolscher/Development/apps/com.lifx/node_modules/node-lifx/lib/lifx/client.js:340:24)
    at Client.<anonymous> (/Users/robinbolscher/Development/apps/com.lifx/node_modules/node-lifx/lib/lifx/client.js:177:12)
    at emitTwo (events.js:87:13)
    at Socket.emit (events.js:172:7)
    at UDP.onMessage (dgram.js:480:8)

Strange thing is, I noticed it did succeed one time to fetch the state form the bulb, but about 9/10 times it fails.

from node-lifx.

Sawtaytoes avatar Sawtaytoes commented on August 11, 2024

I would say there might be something wrong with your network if 9/10 times it fails. Are you running node-lifx off WiFi?

For me, it's more like 1/100 times it fails, but I'm running off Ethernet.

from node-lifx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.