node-red-contrib-npm icon indicating copy to clipboard operation
node-red-contrib-npm copied to clipboard

Custom code example?

Open xcentric7881 opened this issue 7 years ago • 3 comments

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.....

xcentric7881 avatar Nov 24 '17 07:11 xcentric7881

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.

jthomas avatar Nov 25 '17 15:11 jthomas

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...

screen shot 2017-11-28 at 11 29 29

jthomas avatar Nov 28 '17 11:11 jthomas

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.

teddybee avatar Dec 27 '17 17:12 teddybee