====== Node-RED ======
===== Introduction =====
Its configuration is available in ''Configuration => Interfaces => Node-RED'' menu.
{{.:noren.png?600|Node-RED}}
Login details for the connection : spn / spnpwd
{{:wiki:images:node_red_klk_wifc_0401bb.jpg?200|{{.:noren.png?600|Node-RED}}
===== Help =====
Inline help is available in web user interface in ''Configuration => Interfaces => Node-RED => Help''
An extract of this help is available below:
# Common parameters
**SPN** nodes are available in Node-RED nodes menu (**subflows** category).
# Flow syntax
## Rx data flow
**Get Rx data:**
- **SPN/Rx data** node usage is available on node help or description.
## Tx data flow
**Add Tx data:**
- **SPN/Tx data** node usage is available on node help or description.
===== Node examples =====
The following nodes are given as examples to display Rx data and inject manually Tx data.
==== Rx data debugger ====
This node can be plugged directly to ''SPN/Rx data'' node. Once Node-RED enabled and user connected to Node-RED interface, click on ''Node-RED menu => Import => Clipboard'' and paste the following node:
[{"id":"fc15a665.e0b748","type":"subflow","name":"Rx data debugger","info":"","category":"","in":[{"x":70,"y":85,"wires":[{"id":"a11a953c.82f618"}]}],"out":[]},{"id":"a11a953c.82f618","type":"debug","z":"fc15a665.e0b748","name":"Display Rx data on console","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"rx_data","x":288,"y":85,"wires":[]},{"id":"38377a02.373716","type":"subflow:fc15a665.e0b748","z":"e311c66a.1eb5e8","name":"","x":264,"y":435,"wires":[]}]
* Connect ''SPN/Rx data'' output to ''Rx data debugger'' input
* Click on ''Deploy''
* Rx data can be visible on ''debug'' console.
{{.:noren_rx_data_debugger.png|Node-RED, Rx data debugger}}
==== Tx data injector ====
This node can be used to inject manually a Tx data. Then, this Tx data is sent to the expected end-device. Once Node-RED enabled and user connected to Node-RED interface, click on Node-RED menu ⇒ Import ⇒ Clipboard and paste the following node:
[{"id":"e1c67d2e.50814","type":"inject","z":"1c9fa2a7.f4dc5d","name":"Manual Tx data injection","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":540,"wires":[["7c3efe6a.0bb38"]]},{"id":"7c3efe6a.0bb38","type":"change","z":"1c9fa2a7.f4dc5d","name":"Build Tx data","rules":[{"t":"set","p":"tx_data.end_device_id","pt":"msg","to":"AABBCCDD","tot":"str"},{"t":"set","p":"tx_data.port","pt":"msg","to":"2","tot":"num"},{"t":"set","p":"tx_data.acknowledge","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"tx_data.try_number","pt":"msg","to":"5","tot":"num"},{"t":"set","p":"tx_data.payload","pt":"msg","to":"wMrA/sDKwP7AysD+","tot":"str"},{"t":"delete","p":"topic","pt":"msg"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":483,"y":540,"wires":[[]]}]
* Connect ''Build Tx data'' output to ''SPN/Tx data'' input
* Edit ''Build Tx data'' node to set **5** node properties (End-device ID, port, acknowledge, try number and payload)
* Click on ''Deploy''
* Tx data are injected each time ''Manual Tx data injection'' button is clicked
{{.:noren_tx_data_injector.png|Node-RED, Tx data injector}}
In web user interface, it is possible to check in ''Fleet => Send data => Tx data'' that the Tx data injected is available in Tx data list.
===== Node installation and updates =====
It is possible to install new nodes and update already installed nodes through Node-RED interface in ''Main menu => Manage palette''.
Because of hardware limitations, Node-RED nodes update or installation may fail for various reasons (dependency issues, prebuilt package unavailable)