Cookbook updates

#1

I've spent the last couple of days adding recipes to the Cookbook.

All of the placeholder recipes we had in the list now exist, plus a couple more along the way.

I've also created a Node-RED Project that contains all of the recipes: https://github.com/node-red/cookbook-flows that you can clone into your local Node-RED. Admittedly its more there for us maintain the cookbook, but I'm sure it'll be of use to some of you.

As you can see, we're focussed on covering the most common patterns before getting too advanced. My hope is, as questions get asked here on 'how can I do XYZ?' we're able to point at particular recipes rather than provide the same answers again and again. We should also use the insight of what gets asked regularly to consider what recipes we should have.

If you have any suggestions for common patterns we should cover, then please do let us know. Comment here, or come join the #docs channel on slack. For example, I plan to add one on joining separate streams of messages into one as that comes up a lot on here.

And whilst it's focussed on the core nodes, I'm sure we'll expand to have some Dashboard recipes at some point.

5 Likes

#2

Hi Nick, please have a look on the flow for this one (does not match with picture)

0 Likes

#3

@Andrei - thanks. Fixed.

0 Likes

#4

please check this one too Nick.

0 Likes

#5

Also fixed. Have quickly checked the others, don't think I've missed any others. Its been a long day of updating 30 documents/flows/images.

3 Likes

#6

Brilliant. Thanks Nick, a really nice job.

Any interest in this recipe, or is it too exotic?

Search and replace in a string (using split and join nodes)

[{"id":"a4671335.51319","type":"split","z":"646f6b5.a3ebf94","name":"split (search)","splt":"search","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":300,"y":90,"wires":[["fd1dd091.3a3fa8"]]},{"id":"540bb959.84731","type":"inject","z":"646f6b5.a3ebf94","name":"input","topic":"","payload":"first-search-last","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":90,"wires":[["a4671335.51319","78a3cd61.307b74"]]},{"id":"fd1dd091.3a3fa8","type":"join","z":"646f6b5.a3ebf94","name":"join (replace)","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"replace","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":460,"y":90,"wires":[["a3382fb4.8fb9e"]]},{"id":"a3382fb4.8fb9e","type":"debug","z":"646f6b5.a3ebf94","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":620,"y":90,"wires":[]},{"id":"78a3cd61.307b74","type":"debug","z":"646f6b5.a3ebf94","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":300,"y":130,"wires":[]}]
0 Likes

#7

@drmibell whilst a clever technique, we would prioritise the more explainable solution to such a problem - in this case, a single Change node set to change the payload:

[{"id":"860dc495.5d4518","type":"inject","z":"535331d8.55c1f","name":"input","topic":"","payload":"first-search-last","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":580,"wires":[["12af6009.402d9"]]},{"id":"12af6009.402d9","type":"change","z":"535331d8.55c1f","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"search","fromt":"str","to":"replace","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":580,"wires":[["18a27dd1.da8402"]]},{"id":"18a27dd1.da8402","type":"debug","z":"535331d8.55c1f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":520,"y":580,"wires":[]}]
0 Likes

#8

Of course. Just having some fun.

On the other hand, this will give the number occurrences of a substring... :slightly_smiling_face:

[{"id":"860dc495.5d4518","type":"inject","z":"535331d8.55c1f","name":"input","topic":"","payload":"first-search-last","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":580,"wires":[["12af6009.402d9"]]},{"id":"12af6009.402d9","type":"change","z":"535331d8.55c1f","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"search","fromt":"str","to":"replace","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":580,"wires":[["18a27dd1.da8402"]]},{"id":"18a27dd1.da8402","type":"debug","z":"535331d8.55c1f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":520,"y":580,"wires":[]}]
0 Likes