Node Red newbie - first question

Dear @ll,

as a complete newbie in node red, but willing to learn, i instaleld it and some add ons, like mqtt.

I also have mosquitto broker installed, and would like to start the first flow, as sending an mqtt message to the broker, process it by node-red, sending a reply to the broker.

Any tutorial or example, where i can start to look at?

Thank you all for any support.

Here is an example (use CTRL I to import to editor)
You will need to add you mosquitto settings to the mqtt config node, click the pencil in any of the mqtt nodes, and add your mqtt server

[{"id":"78724214.647b3c","type":"mqtt in","z":"c74669a0.6a34f8","name":"","topic":"test/data","qos":"0","datatype":"auto","broker":"e8ba3ef5.22f4a8","x":190,"y":2680,"wires":[["27ca0938.dbaa9e"]]},{"id":"27ca0938.dbaa9e","type":"function","z":"c74669a0.6a34f8","name":"","func":"msg.payload = msg.payload * 10;\nmsg.topic = \"test/result\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":2680,"wires":[["6de20b58.5c9a24"]]},{"id":"ce48dc83.c4d5e8","type":"comment","z":"c74669a0.6a34f8","name":"receive data and return result ","info":"this returns result to a different topic","x":390,"y":2640,"wires":[]},{"id":"6de20b58.5c9a24","type":"mqtt out","z":"c74669a0.6a34f8","name":"","topic":"","qos":"0","retain":"false","broker":"e8ba3ef5.22f4a8","x":530,"y":2680,"wires":[]},{"id":"b239b6f3.fb7dc","type":"comment","z":"c74669a0.6a34f8","name":"subscribe and publish","info":"these can be any where they are just here to see example . you counld publish from command line to test/data\nand subscribe to test/result","x":430,"y":2760,"wires":[]},{"id":"18e4381a.81bb2","type":"mqtt in","z":"c74669a0.6a34f8","name":"subscribe to result","topic":"test/result","qos":"0","datatype":"json","broker":"e8ba3ef5.22f4a8","x":340,"y":2800,"wires":[["eb4b7ab6.ac7fa"]]},{"id":"940a9a16.f74ee8","type":"inject","z":"c74669a0.6a34f8","name":"publish mqtt data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"test/data","payload":"10","payloadType":"num","x":210,"y":2860,"wires":[["f02fa7d4.a1ef6"]]},{"id":"f02fa7d4.a1ef6","type":"mqtt out","z":"c74669a0.6a34f8","name":"","topic":"","qos":"0","retain":"false","broker":"e8ba3ef5.22f4a8","x":410,"y":2860,"wires":[]},{"id":"eb4b7ab6.ac7fa","type":"debug","z":"c74669a0.6a34f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":550,"y":2800,"wires":[]},{"id":"e8ba3ef5.22f4a8","type":"mqtt-broker","name":"testb","broker":"192.168.1.25","port":"1883","clientid":"node-red","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

it takes any number and times it by 10 so the payload must be a number

P.S. Welcome

Welcome to the forum @pw44

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

1 Like

@E1cid [quote="E1cid, post:2, topic:46098"]
Here is an example (use CTRL I to import to editor)
[/quote]

Thank you so much. WIll try and see.

@Colin
thank you so much for the hint.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.