Global variables in node red - Printable Version

+- OpenMarine (
+-- Forum: OpenPlotter (
+--- Forum: Node Red (
+--- Thread: Global variables in node red (/showthread.php?tid=929)

Global variables in node red - PaddyB - 01-06-2018

Maybe everyone else knows all this already, but I've just been digging deeper into global variables in node red. 
There's a node for seeing what they contain, search for 'node-red-contrib-contextbrowser' in the managepalette-install. also you can initialise them with any value on startup with a config node - node-red-contrib-config and view them straight in a browser.

So rather than parse through nmea 0r signalk messages it seems much easier to grab the messages once as they come in and assign the values to global variables, the change node makes this easy. 
For instance I have an ESP32 with various sensors sending data to the Pi over mqtt, this node puts the pressure into global.pressure where it's easier to get at for other flows to put it into a graph or database.
Hope this helps.

SOme more here -

       "id": "6f1e8f4b.0d7e6",
       "type": "change",
       "z": "3f30ea31.da3756",
       "name": "",
       "rules": [
               "t": "set",
               "p": "pressure",
               "pt": "global",
               "to": "payload",
               "tot": "msg"
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 411,
       "y": 1605,
       "wires": [
       "id": "9a48ef5e.a7d12",
       "type": "mqtt in",
       "z": "3f30ea31.da3756",
       "name": "",
       "topic": "Esp1BMP280Pressure",
       "qos": "2",
       "broker": "c2e0624.6088ea",
       "x": 161,
       "y": 1605,
       "wires": [
       "id": "c2e0624.6088ea",
       "type": "mqtt-broker",
       "z": "",
       "broker": "",
       "port": "1883",
       "clientid": "",
       "usetls": false,
       "compatmode": true,
       "keepalive": "60",
       "cleansession": true,
       "willTopic": "",
       "willQos": "0",
       "willPayload": "",
       "birthTopic": "",
       "birthQos": "0",
       "birthPayload": ""