node-red-contrib-npm
node-red-contrib-npm copied to clipboard
Custom code example?
Am struggling with using the custom code, and examples would help.
Have a working node red installation and installed this and other components.
Want to use the tplink-lightbulb node, https://www.npmjs.com/package/tplink-lightbulb, but cannot understand how to get this module to trigger the relevant actions - e.g. turn bulb on.
Assistance appreciated - it's a user problem rather than a technical issue.....
Thanks for opening this issue. I'll look into it in a few days...
I agree the project needs more examples in the documentation. I'll try to update the README to make it simpler for people to use the module.
Looking at how this module works, you're going to have to use the "custom" code style for interacting with the device.
I don't have a device to test locally but I think the following code should work...

I have similar issues (probably lack of knowledge) It would be nice to have a sample code for the situation when the npm module has a custom constructor and calling a method at every msg input event that provides data in a callback.