Using the Node Red Change Node-Beginners Guide
HTML-код
- Опубликовано: 26 авг 2024
- Continuing the series on the node red core nodes we look at the node-red change node with examples of using it. Covers Set,Change,move and delete and also using jsonata with JSON data.
The video tutorial is targeted at beginners just starting out using node-red.
JSONATA web site -jsonata.org/
Website
stevesnoderedg...
Related videos
Node-Red Function Node for Beginners
• Node-Red Function Node...
----------
Beginners Guide to Node-Red Inject and Debug Nodes
• Beginners Guide to Nod...
Node-Red Join Node For Beginners
• Node-Red Join Node Ste...
-------------
Node-Red Split Node for Beginners
• Node-Red Split Node fo...
If you find these videos useful then you might want to consider buying me a coffee
www.paypal.me/...
Thanks, really helpful... especially the test part (min 9), I was giving up and found his video!
tks for the comment glad it helped
Hi Steve, I find your tutorials series very helpful and very well explained. Thank you for that. I am rather new to node-RED, i use it in stead of the rules editor of openHAB.
What i am missing still are better UI tools e.g. a scheduler with which one can configure timing stuff from he UI, not from the NR editor. I searched for this without success, but hopefully this will come sometime.
Bert
If the timer allows control via the msg input then you can create your own dashboard to control it. I'll try to put together a video to do it as it is something I'm sure a lot of people will find useful. Take a look at EZtimer
rgds
steve
Very helpful as always. Now want to learn more about jsonata expressions. Thanks for your insights. Also looking for a way to use the audio out node to play a short mp3 file followed by text to speech. I don't understand how to work with buffers that node requires for audio files.
buffers are on my list
Jesus TY for this 1:17
The video states specifically that there would be a link in the comments for JSONata. It is not there.
I would love a more advanced video on JSONata, especially in connection with Node Red. A real missing topic is how do you add to a JSON list, a new element to the list, or how do you update or delete one. The documentation is poor and it takes weeks to get the basics. This is a whole in the video tutorials. Thanks.
Jim
Sorry I forgot to add it. Here it is
jsonata.org/
There is also a video that goes more in depth.
Rgds Steve
Can we set the a form to null using this node?
thanks!
Hi Steve great video, I want to pass in an array to the payload in a change node, I will then pass it to a split node. I have it working if I use a function node but I am trying to reduce a step. I thought I could do it directly in the change node but I can't get this working. Can you help? Thanks!
DaveI did a video on split node that may helpNode-Red Split Node for Beginners
ruclips.net/video/VK5Uy38s6V0I/видео.htmlf you still have problems after that use the asksteve page on the site and email me the flow and I'll take a lookrgdssteve
what does set.global means?
Se global set a global object or vatiable, Take a look at this video
ruclips.net/video/kNfP1vw2Img/видео.html
So I watched this video 20+ times, which so far has been the best at describing the "Change" Node functionality.
However, I am totally confused.
I am trying to parse out the "Temperature" value from this object:
{"topic":"tele/Mysonoff_TH10/SENSOR","payload":"{\"Time\":\"2018-12-21T16:51:09\",\"AM2301\":{\"Temperature\":69.4,\"Humidity\":33.9},\"TempUnit\":\"F\"}","qos":0,"retain":false,"_topic":"tele/Mysonoff_TH10/SENSOR","_msgid":"dae7f7bc.36e5f8"}
NOTE: Feeding this object is a MQTT In Node
1) Opened Change Object and selected "Set" and "msg.payload"
2) Selected "Json Expression"
3) Selected the "Edit" function for JSON
4) Entered "{"ParsedTemp":payload.Temperature}
5) From the Debug window, selected the icon to copy the Object value
6) Pasted that copied Object value into the "Example" window
7) The result was just {}
NOTE: I noticed when you pasted your object into the window, the msgID was the first in the string while mine has the msgID at the end and you can see that above in the complete object message.
All I want to do is to turn on the Sonoff TH10 if the temperature < 74 and turn it off if >75.
Mike
Understand your frustration it took me a while to figure it out.
The payload is actually a JSON string.
so you need to convert the string to a JSON object before you can access it using the dot mechanism.
In addition the temperature is a property of AM2301
so its is
something.AM2301.Temperature
You can use the change node to extract the payload using
payload.payload
and then pass it to a JSON node and the a function node to get the data.
If you use the ask steve page on the site I can send you the flow I created to extract your data.
If you send me your flow I will help you with it as you should have the data in a simpler format.
Rgds
steve
@@stevecope WOW! I never expected such a detailed response. Thank you very much. I did add the JSON node and now I have the parsed out temperature value.
I played with the Function node for about 6 hours yesterday with little success. I'll post the flow on the "Ask Steve" page and expect a donation! Thanks again.