So here we have a simple app in Node-red. It recieves a json message with mqtt, then saves it in a cloudant database and a sql database. In this recipie I am going to show how it works.
First you need to double click the mqtt block and you wil open this window.
Then add a new broker by pressing the pencil marked on the picture.
A new window wil open and you need to fill in the parts marked on the picture.
After that you can subscribe to a topic of your choise.
The debug node in node-red is great for showing the messages your app recieves. Just connect it to a node then it wil show the messages passing through.
Saving in a cloudant database can be done very easy. Cloudant is a noSql database where the messages are saved as a json object.
The function node in the app, just replaces the payload of the message. Then sends it to a mqtt out node, where the message is sent to a different topic.
For saving in the sql database se the following recipie.http://recipes.item.ntnu.no/saving-to-a-sql-database-node-red/
1,907 thoughts on “Simple Node-red application”