-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unidentified bulb, But works via App #11
Comments
Unfortunately the short answer is no. The underlying Node.js library node-lifx/lifx-lan-client (which I also poorly try to maintain) does support listening to command responses via callback functions and querying the light state explicitly. The original developer of this plugin/extension has decided not to support either use case. If the lights are show up as if they were connected but intermittently the command won't get through, it sounds like they're too far away from the router. You can try to reduce the issue by repeating each command 1-3 times. The messages can come immediately after each other, the underlying library holds queues for each light which is then processed with the max specified rate of the lights (20ms IIRC). If the lights randomly disconnect in a way you can see it in Node-RED, there's one thing you could try. If I remember correctly, the input nodes send the changed light state only if the light is online. Perhaps this way you could create logic to check if the command was succesful? This only works though if the lights are detected to be offline (which seems to be quite accurate in my experience). I did a quick example flow you can experiment this with. You'll just need to reconfigure the lifx nodes. I hope this helps. [{"id":"6d0fde7a.215a1","type":"node-lifx-out","z":"9f23215e.ca09a","server":"28037156.91f72e","name":"online light","lightID":"d073d53db8c7","x":180,"y":180,"wires":[["28f3dbed.701044"]]},{"id":"100155c5.4ba67a","type":"node-lifx-in","z":"9f23215e.ca09a","server":"28037156.91f72e","name":"online light","lightID":"d073d53db8c7","x":420,"y":120,"wires":[]},{"id":"d6a6162a.e0b808","type":"inject","z":"9f23215e.ca09a","name":"","topic":"","payload":"","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":135,"y":120,"wires":[["7297ebe7.fd9c54"]],"l":false},{"id":"7297ebe7.fd9c54","type":"function","z":"9f23215e.ca09a","name":"random state","func":"const randomInt = (min, max) => {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n\nmsg.payload = {\n on: true,\n brightness: randomInt(0, 30),\n hue: randomInt(0, 255),\n sat: randomInt(0, 100),\n duration: 1000\n};\n\nreturn msg;\n","outputs":1,"noerr":0,"x":250,"y":120,"wires":[["100155c5.4ba67a"]]},{"id":"28f3dbed.701044","type":"debug","z":"9f23215e.ca09a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":340,"y":180,"wires":[]},{"id":"20a4e353.57c49c","type":"node-lifx-in","z":"9f23215e.ca09a","server":"28037156.91f72e","name":"offline light","lightID":"d073d5394495","x":420,"y":280,"wires":[]},{"id":"c14e000c.b41bf","type":"node-lifx-out","z":"9f23215e.ca09a","server":"28037156.91f72e","name":"offline light","lightID":"d073d5394495","x":180,"y":340,"wires":[["c7c69c6e.80f65"]]},{"id":"9c4b045f.f6c538","type":"inject","z":"9f23215e.ca09a","name":"","topic":"","payload":"","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":135,"y":280,"wires":[["6ca9be26.bf21"]],"l":false},{"id":"6ca9be26.bf21","type":"function","z":"9f23215e.ca09a","name":"random state","func":"const randomInt = (min, max) => {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n\nmsg.payload = {\n on: true,\n brightness: randomInt(0, 30),\n hue: randomInt(0, 255),\n sat: randomInt(0, 100),\n duration: 1000\n};\n\nreturn msg;\n","outputs":1,"noerr":0,"x":250,"y":280,"wires":[["20a4e353.57c49c"]]},{"id":"c7c69c6e.80f65","type":"debug","z":"9f23215e.ca09a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":340,"y":340,"wires":[]},{"id":"28037156.91f72e","type":"node-lifx-server","z":"","name":"Server","address":"","broadcast":"255.255.255.255","lights":"","interval":"10000"}] |
Often because of my WiIi a bulb will drop off / cant be found on the network but its still able to work via the Lifx App so I at least know its still on the network.
Is there some sort of way to get a output from the light based on if it was able to complete the action, or if it failed?
I would like to build in a backup which would use the Lifx API (slower I know) to trigger the same action if the LAN event failed.
But i cannot currently see a way of knowing when a bulb / action fails.
The text was updated successfully, but these errors were encountered: