The Smart Parks Stack is widely using Node-RED for the integration between the devices controlled by the LoRaWAN network, the various databases and the admin and user applications like Earth Ranger.
Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways.
It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.
Like with other platforms and tools that are being used in the Smart Parks Stack, we do not want to copy all the information that is provide by Node-RED themselves. We rather want to focus this Wiki on the specific elements we believe are useful to describe.
The Smart Parks Stack uses the following Node-RED nodes:
These nodes can all be installed via the “Managed Palette” tool in the User Settings.
The Smart Parks Stack uses the following Node-RED flows:
To process the device uplink messages coming from the ChirpStack LoRaWAN server, we use the standard mqtt input node
to connect to the uplink messaging feed coming from ChirpStack. Using different mqtt input nodes to subscribe to different ChirpStack Applications, we can differentiate between LoRaWAN sites. We use the Add - Site key change node
to add a tag to the payload, so that the flows are aware of the site this messages us coming from. Next we add a switch node
to check if the payload needs to be processed further to be uploaded to Earth Ranger. Finally we use a link out node
to send to flow to te Earth Ranger tab.
application/1/device/#
msg.payload.site
to <site name>msg.payload.tags.ER
= yesThe collection of flows is to ensure incoming messages intended for Earth Ranger are send to the correct location. First we get messages into this flow from the link in node
coming from the ChirpStack Uplink tab. We feed this into the payloadType switch node
to check what payload decoder is used in the ChirpStack and send it to the correct flow for further processing into the Earth Ranger format. The messages are send to the correct flow using a link our node
. When then the messages is processed into the correct Earth Ranger format, the flow will continue via the link in node
. The next step is a Site selector switch node
directing the messages towards the correct Earth Ranger site.
The alternative for using the @smartparks/node-red-contrib-earthranger node, it is possible to use the standard HTTP Request node, to post the data to Earth Ranger using a token. This way all features of the Earth Ranger API can be used with a bit more flexibility.
will be uploaded soon
Smart Parks Engineer Friso Modderman has developed a set of Node-RED nodes that makes it easier to push data into an Earth Ranger instance. This set of core nodes is called: @smartparks/node-red-contrib-earthranger
and can be found here:
This set currently provides the following nodes:
The code if published on the Smart Parks GitHub here: