Closed bland328 closed 6 years ago
@bland328 I have done a bunch of tweaks to both node-lifx and node-red-contrib-node-lifx to improve the reliability/performance on my own branches. Out curiosity, would you like to try if it makes any difference if you try the version I'm currently using? It combines modifications I've done to both modules. You can do it by the following steps:
~/.node-red
run npm install github:ristomatti/node-red-contrib-node-lifx#development
The node-lifx version I have as a dependency for node-red-contrib-node-lifx requires a postinstall script to be run which I remember having issues on some Node version. The version I am running is 8.9.x.
I won't be able to solve the issue as such but maybe this might be of some help debugging the problem.
@bland328 Can you provide the output from the code below, the problem is probably in the capability scanning code
'use strict';
var Lifx = require('node-lifx').Client;
var client = new Lifx();
client.on('error', function(err) {
console.log('LIFX error:\n' + err.stack);
client.destroy();
});
client.on('light-new', function(light) {
light.getHardwareVersion((err, data) => {
console.log('getHardwareVersion', light.id, err ? err.message : data);
});
light.getMaxIR((err, data) => {
console.log('getMaxIR', light.id, err ? err.message : data);
});
light.getState((err, data) => {
console.log('getState', light.id, err ? err.message : data);
})
});
client.on('listening', function() {
var address = client.address();
console.log(
'Started LIFX listening on ' +
address.address + ':' + address.port + '\n'
);
});
client.init({
//broadcast: "192.168.1.255",
messageHandlerTimeout: 1000,
//debug: true,
});
@ristomatti, thanks very much for the idea and assistance. I'll give it a try soon and share the results.
@jdomeij, thanks for the code! Here's the results, with some light censoring, due to paranoia ;)
Started LIFX listening on 0.0.0.0:56700
getHardwareVersion d0xxxxxxxx8f { vendorId: 1,
productId: 22,
version: 0,
vendorName: 'LIFX',
productName: 'Color 1000',
productFeatures: { color: true, infrared: false, multizone: false } }
getState d073d511bc8f { color: { hue: 1, saturation: 98, brightness: 100, kelvin: 2500 },
power: 0,
label: 'BRR' }
getHardwareVersion d0xxxxxxxxab { vendorId: 1,
productId: 29,
version: 0,
vendorName: 'LIFX',
productName: 'LIFX+ A19',
productFeatures: { color: true, infrared: true, multizone: false } }
getHardwareVersion d0xxxxxxxxd0 { vendorId: 1,
productId: 22,
version: 0,
vendorName: 'LIFX',
productName: 'Color 1000',
productFeatures: { color: true, infrared: false, multizone: false } }
getState d0xxxxxxxxab { color: { hue: 320, saturation: 26, brightness: 100, kelvin: 3500 },
power: 0,
label: MBR' }
getState d0xxxxxxxxd0 { color: { hue: 1, saturation: 98, brightness: 100, kelvin: 2500 },
power: 0,
label: 'BRL' }
getHardwareVersion d0xxxxxxxx5b { vendorId: 1,
productId: 30,
version: 0,
vendorName: 'LIFX',
productName: 'LIFX+ BR30',
productFeatures: { color: true, infrared: true, multizone: false } }
getMaxIR d0xxxxxxxx8f No LIFX response in time
getMaxIR d0xxxxxxxxd0 No LIFX response in time
getMaxIR d0xxxxxxxxab No LIFX response in time
getState d0xxxxxxxx5b { color: { hue: 319, saturation: 0, brightness: 100, kelvin: 2500 },
power: 0,
label: 'MBT' }
getMaxIR d0xxxxxxxx84 No LIFX response in time
getHardwareVersion d0xxxxxxxxea No LIFX response in time
getState d0xxxxxxxxea No LIFX response in time
getMaxIR d0xxxxxxxx35 No LIFX response in time
getMaxIR d0xxxxxxxx5b No LIFX response in time
getState d0xxxxxxxx84 No LIFX response in time
getHardwareVersion d0xxxxxxxx35 No LIFX response in time
getHardwareVersion d0xxxxxxxx84 No LIFX response in time
getState d0xxxxxxxx35 No LIFX response in time
getMaxIR d0xxxxxxxxea No LIFX response in time
@jdomeij, I also noticed when restarting Node-RED just now, this console output:
21 Jan 17:30:17 - [error] [node-lifx-server:Lifx Server] No LIFX response in time
21 Jan 17:30:18 - [error] [node-lifx-server:Lifx Server] No LIFX response in time
21 Jan 17:30:18 - [error] [node-lifx-server:Lifx Server] No LIFX response in time
21 Jan 17:30:20 - [error] [node-lifx-server:Lifx Server] No LIFX response in time
Interestingly, @ristomatti reported such behavior at https://github.com/MariusRumpf/node-lifx/issues/55, but as I mentioned in my original post, when I use the node-lifx interactive-cli.js
utility, it communicates fine with all my bulbs, meaning that node-lifx does have the ability to communicate with all my bulbs, at least under particular circumstances. Edit: I see that getMaxIR isn't called by that code, since it doesn't investigate the available bulbs all that deeply.
@bland328 so did I understand correctly, the bulbs started working with my version of the code? Now that you reported the same on node-lifx repo, I remember having similar issues. I actually even have a PR open to fix a problem related to IR bulbs. It's been open since May.
I believe the console output you're seeing is from node-lifx and is printed when a light does not respond to a query for info or state. I don't remember if node-red-contrib-node-lifx was even using the information for anything(?). But if the lights work you can ignore the error.
Unfortunately I don't have the bulbs you've mentioned to test but based on the product name I assume the bulbs not being detected are IR bulbs?
@bland328 Yoo, i have published an new version on npm that should fix the problem. The problem is like @ristomatti says is in the getMaxIR function that returns an error.
The IR capability has been added blindly because I only have the original Lifx lights, the fix I made is to skip using the getMaxIR if it returns error during initialization, you can still set the IR level but there will be no poll updates to the IR level.
@ristomatti, I did not get to try your code because of an unresolved battle between the postinstall script and my version of npm, I'm sorry to report. And, to answer your IR question--yes, all of my problematic bulbs are IR-capable.
@jdomeij, that makes perfect sense to me. And I can confirm that the configuration node now offers all of my bulbs, and I did see on/off status flowing in from one of the IR-capable bulbs that was formerly missing! I don't have time to test further at the moment, but I assume this closed for my purposes. Thanks very, very much!
@bland328 the postinstall script issue you're having I've also encountered with some npm version. The postinstall script was a quick hack for my own use to get my custom version of node-lifx to build when it's fetched as a GitHub dependency. The issue is not related to either node-red-contrib-node-lifx or node-lifx.
But anyhow - great this was addressed by @jdomeij and the issue is gone!
tl;dr: node-red-contrib-node-lifx works with my older LIFX bulbs, but not my newer LIFX bulbs.
I have seven (7) LIFX bulbs on my network:
All bulbs are updated to the latest firmware, and I'm using the latest
Node-RED v0.17.5
andnode-red-contrib-node-lifx 0.9.1
.Using
node-red-contrib-node-lifx
, when I create just onenode-lifx-out
node and configure an Lifx Server for it, I'm leaving all fields at default values (Address
,Broadcast
andLights
all blank,Poll interval
of 10000 andName
of "Lifx Server").When I then click the Search button next to the Light ID field in the
Edit node-lifx-out node
panel, the dropdown is consistently populated (even after rebooting) with just three (3) bulbs:As a test, I stopped Node-RED and tried
interactive-cli.js
in the~/.node-red/node_modules/node-red-contrib-node-lifx/node_modules/node-lifx/example/
directory; it found all seven (7) bulbs immediately, and was able to control all of them.I do notice that it is my three oldest, non-"plus" bulbs that are working, but since
node-lifx
0.8.0 supports all of my bulbs, I would thinknode-red-contrib-node-lifx
would, too.Or is it expected that
node-red-contrib-node-lifx
doesn't yet support these bulbs?