chirpstack / node-red-contrib-chirpstack

ChirpStack Node-RED nodes
https://www.chirpstack.io/
MIT License
13 stars 5 forks source link

ChirpStack Node-RED nodes

This package contains ChirpStack nodes for using with Node-RED.

example flow

Installation

Please read the Adding nodes to the palette documentation for information on installing third-party nodes to Node-RED.

Example command:

npm install @chirpstack/node-red-contrib-chirpstack

Usage example

This usage example creates an echo flow, which returns the received uplink back to the device.

MQTT in node (Node-RED)

After the @chirpstack/node-red-contrib-chirpstack package has been installed, the first thing you must do is create a MQTT subscription using the mqtt in node.

After deploying the flow containing the mqtt in node, you should see a green bullet under the node with the status connected. If that is not the case, validate the hostname, port and TLS configuration (if appliable).

Device event node (ChirpStack)

After setting up the mqtt in node, add one or multiple device event nodes. For each node you can select the Event Type. For this usage example select Uplink. Connect this node with the mqtt in node.

Debug node (Node-RED)

Add a debug node and connect it with the device event [up] node to log the msg.payload for debugging.

Echo function node (Node-RED)

Add a function node, and add the following code to the On Message event:

return {
    "payload": msg.payload.data,
    "fPort": msg.payload.fCnt,
    "confirmed": false,
    "devEui": msg.payload.deviceInfo.devEui
};

Connect this node with the device event [up] node.

Downlink node (ChirpStack)

Add a device downlink node and enter:

Connect this node with the echo function node.

Debug node (Node-RED)

Add an other debug node and connect it with the downlink node. This will print the downlink frame-counter as debugging information. Make sure the Output is set to complete msg object.