I am using the ewelink node and am stuck on trying to get a specific piece of data from the event listener node.
The following is the debug output:
I'm trying to access the switch variable (which can be either on or off) in the params object.
I have copied the path to the params switch variable: 'payload.params.switch'.
Maybe naively, in the function node I added:
var onoff = payload.params.switch;
I now get an error message:
ReferenceError: payload is not defined (line 1, col 13)
Can anyone help in my error. Ive tried square and curly brackets and reading lots from google and node red but cant find an answer.
Also, trying to find a beginners book on node red but cant find any which I find quite unusal.
There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.
Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.
As a newbee, I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.
When you copy the path , it does not copy the initial object e.g. msg
Hi, thanks for you reply. I have followed, read and watched all what you have suggested but no where can I find info on how to pull a specific data item from the object. Cheers....
Hi, thanks for your reply. That did the trick. Its always something that is so simple which I can never find. I desperately need an idiots guide to node-red....
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.