This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Node-RED - Serial Nodes
#6
(2017-10-12, 02:49 PM)abarrow Wrote: Perhaps that is the answer! Thanks.

This is some node-red I use to graph and monitor some signalk data - you might be able to edit or copy some of this to speed things up. i never really got on with freeboard so got rid of it a long tome ago. With lots of date the charts on node-red can get a bit slow so it's good to limit just how much is getting sent. Also I log everything to a sqlite database and create some node-red charts from that. If you go the dashboard route and want to have a look at a database just ask & I'll upload some more flows. 

[Image: zbPg59P.gif]

(Easy to see where the power in the boatyard I'm in went off today and I had to turn on the solar panels Smile ) 
Code:
[
   {
       "id": "67b79641.1fad68",
       "type": "websocket in",
       "z": "749e8283.293f4c",
       "name": "SignalK input",
       "server": "fc1b2b62.0b63a8",
       "client": "",
       "x": 90,
       "y": 120,
       "wires": [
           [
               "20af45d9.7fe30a"
           ]
       ]
   },
   {
       "id": "20af45d9.7fe30a",
       "type": "json",
       "z": "749e8283.293f4c",
       "name": "",
       "pretty": false,
       "x": 90,
       "y": 305,
       "wires": [
           [
               "dbc264db.e996e8",
               "8b31ff78.f9f4",
               "4e228623.5d83f8",
               "8b385a5c.b0c248",
               "2c398bd9.039814",
               "825023eb.4bddb"
           ]
       ]
   },
   {
       "id": "dbc264db.e996e8",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Filter engine temp",
       "rules": [
           {
               "t": "set",
               "p": "payload",
               "pt": "msg",
               "to": "msg.payload.updates.values[path=\"propulsion.eng.temperature\"].value",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 290,
       "y": 145,
       "wires": [
           [
               "12d0fbb4.557744"
           ]
       ]
   },
   {
       "id": "8b31ff78.f9f4",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Filter alt temp",
       "rules": [
           {
               "t": "set",
               "p": "payload",
               "pt": "msg",
               "to": "msg.payload.updates.values[path=\"propulsion.alt.temperature\"].value",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 300,
       "y": 225,
       "wires": [
           [
               "4a8866f9.186ab8"
           ]
       ]
   },
   {
       "id": "4e228623.5d83f8",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Filter exhaust temp",
       "rules": [
           {
               "t": "set",
               "p": "payload",
               "pt": "msg",
               "to": "msg.payload.updates.values[path=\"propulsion.exh.temperature\"].value",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 310,
       "y": 325,
       "wires": [
           [
               "3d303b8e.883b74"
           ]
       ]
   },
   {
       "id": "8b385a5c.b0c248",
       "type": "link out",
       "z": "749e8283.293f4c",
       "name": "To database",
       "links": [
           "1297a3e2.92bf2c",
           "1eef2563.1f8deb",
           "1996dede.bab381",
           "13276a54.97c086",
           "745f2a9.eb953d4",
           "b4298a7c.2713e8"
       ],
       "x": 75,
       "y": 400,
       "wires": []
   },
   {
       "id": "2c398bd9.039814",
       "type": "switch",
       "z": "749e8283.293f4c",
       "name": "Is it batt data?",
       "property": "payload.updates.\"$source\"",
       "propertyType": "jsonata",
       "rules": [
           {
               "t": "eq",
               "v": "OPsensors.I2C.ADS1115",
               "vt": "str"
           }
       ],
       "checkall": "false",
       "outputs": 1,
       "x": 235,
       "y": 405,
       "wires": [
           [
               "4ad31cf4.e60904"
           ]
       ]
   },
   {
       "id": "825023eb.4bddb",
       "type": "switch",
       "z": "749e8283.293f4c",
       "name": "Is it Met data?",
       "property": "payload.updates.\"$source\"",
       "propertyType": "jsonata",
       "rules": [
           {
               "t": "eq",
               "v": "OPsensors.I2C.BMP180",
               "vt": "str"
           }
       ],
       "checkall": "false",
       "outputs": 1,
       "x": 240,
       "y": 520,
       "wires": [
           [
               "f590e0b7.3a69e"
           ]
       ]
   },
   {
       "id": "12d0fbb4.557744",
       "type": "switch",
       "z": "749e8283.293f4c",
       "name": "Is it empty?",
       "property": "payload",
       "propertyType": "msg",
       "rules": [
           {
               "t": "nnull"
           }
       ],
       "checkall": "true",
       "outputs": 1,
       "x": 350,
       "y": 185,
       "wires": [
           [
               "d652486c.7ed398",
               "accdb940.5e5d38"
           ]
       ]
   },
   {
       "id": "4a8866f9.186ab8",
       "type": "switch",
       "z": "749e8283.293f4c",
       "name": "Is it empty?",
       "property": "payload",
       "propertyType": "msg",
       "rules": [
           {
               "t": "nnull"
           }
       ],
       "checkall": "true",
       "outputs": 1,
       "x": 370,
       "y": 265,
       "wires": [
           [
               "b3490042.bbd67",
               "23f49bc6.7d4f34"
           ]
       ]
   },
   {
       "id": "3d303b8e.883b74",
       "type": "switch",
       "z": "749e8283.293f4c",
       "name": "Is it empty?",
       "property": "payload",
       "propertyType": "msg",
       "rules": [
           {
               "t": "nnull"
           }
       ],
       "checkall": "true",
       "outputs": 1,
       "x": 370,
       "y": 365,
       "wires": [
           [
               "41967fda.ebcdf",
               "ee7ce1a6.f4d62"
           ]
       ]
   },
   {
       "id": "4ad31cf4.e60904",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "create msg.BATT",
       "rules": [
           {
               "t": "set",
               "p": "payload",
               "pt": "msg",
               "to": "payload.updates[0].values[1].$round(value)/1000",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 245,
       "y": 450,
       "wires": [
           [
               "ed9cb4da.8160b8"
           ]
       ]
   },
   {
       "id": "f590e0b7.3a69e",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "create msg.presure",
       "rules": [
           {
               "t": "set",
               "p": "payload",
               "pt": "msg",
               "to": "msg.payload.updates.values[path=\"environment.outside.pressure\"].$round(value)/100",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 260,
       "y": 565,
       "wires": [
           [
               "df31db1.f450628",
               "59d07035.07b67"
           ]
       ]
   },
   {
       "id": "d652486c.7ed398",
       "type": "delay",
       "z": "749e8283.293f4c",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "minute",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 670,
       "y": 145,
       "wires": [
           [
               "cb80fafe.8bc1d8"
           ]
       ]
   },
   {
       "id": "accdb940.5e5d38",
       "type": "delay",
       "z": "749e8283.293f4c",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "second",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 670,
       "y": 185,
       "wires": [
           [
               "6cddc5a1.97f00c"
           ]
       ]
   },
   {
       "id": "b3490042.bbd67",
       "type": "delay",
       "z": "749e8283.293f4c",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "minute",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 670,
       "y": 225,
       "wires": [
           [
               "c476748a.0d02b8"
           ]
       ]
   },
   {
       "id": "23f49bc6.7d4f34",
       "type": "delay",
       "z": "749e8283.293f4c",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "minute",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 670,
       "y": 265,
       "wires": [
           [
               "30135c60.5c6134"
           ]
       ]
   },
   {
       "id": "41967fda.ebcdf",
       "type": "delay",
       "z": "749e8283.293f4c",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "minute",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 670,
       "y": 305,
       "wires": [
           [
               "5ac0570d.33b958"
           ]
       ]
   },
   {
       "id": "ee7ce1a6.f4d62",
       "type": "delay",
       "z": "749e8283.293f4c",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "second",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 670,
       "y": 345,
       "wires": [
           [
               "2af0ffc5.36311"
           ]
       ]
   },
   {
       "id": "ed9cb4da.8160b8",
       "type": "delay",
       "z": "749e8283.293f4c",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "second",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 660,
       "y": 420,
       "wires": [
           [
               "4439e0f6.da26d"
           ]
       ]
   },
   {
       "id": "df31db1.f450628",
       "type": "debug",
       "z": "749e8283.293f4c",
       "name": "",
       "active": false,
       "console": "false",
       "complete": "false",
       "x": 640,
       "y": 580,
       "wires": []
   },
   {
       "id": "59d07035.07b67",
       "type": "delay",
       "z": "749e8283.293f4c",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "second",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 650,
       "y": 500,
       "wires": [
           [
               "2af10602.ee0eca"
           ]
       ]
   },
   {
       "id": "cb80fafe.8bc1d8",
       "type": "function",
       "z": "749e8283.293f4c",
       "name": "Convert to deg C",
       "func": "var numInput = Number(msg.payload);\nmsg.topic = \"Eng\";\nvar T =  numInput-273.15;\nmsg.payload = T.toFixed(1);\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 850,
       "y": 145,
       "wires": [
           [
               "985338c6.d20748"
           ]
       ]
   },
   {
       "id": "6cddc5a1.97f00c",
       "type": "function",
       "z": "749e8283.293f4c",
       "name": "Convert to deg C",
       "func": "var numInput = Number(msg.payload);\nmsg.topic = \"Eng\";\nvar T =  numInput-273.15;\nmsg.payload = T.toFixed(1);\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 850,
       "y": 185,
       "wires": [
           [
               "f66f5fb8.176a1"
           ]
       ]
   },
   {
       "id": "c476748a.0d02b8",
       "type": "function",
       "z": "749e8283.293f4c",
       "name": "Convert to deg C",
       "func": "var numInput = Number(msg.payload);\nmsg.topic = \"Eng\";\nvar T =  numInput-273.15;\nmsg.payload = T.toFixed(1);\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 850,
       "y": 225,
       "wires": [
           [
               "c64d6283.aca53"
           ]
       ]
   },
   {
       "id": "30135c60.5c6134",
       "type": "function",
       "z": "749e8283.293f4c",
       "name": "Convert to deg C",
       "func": "var numInput = Number(msg.payload);\nmsg.topic = \"Eng\";\nvar T =  numInput-273.15;\nmsg.payload = T.toFixed(1);\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 850,
       "y": 265,
       "wires": [
           [
               "2e9c3f90.ea532"
           ]
       ]
   },
   {
       "id": "5ac0570d.33b958",
       "type": "function",
       "z": "749e8283.293f4c",
       "name": "Convert to deg C",
       "func": "var numInput = Number(msg.payload);\nmsg.topic = \"Eng\";\nvar T =  numInput-273.15;\nmsg.payload = T.toFixed(1);\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 850,
       "y": 305,
       "wires": [
           [
               "9ca91b03.6c5c38"
           ]
       ]
   },
   {
       "id": "2af0ffc5.36311",
       "type": "function",
       "z": "749e8283.293f4c",
       "name": "Convert to deg C",
       "func": "var numInput = Number(msg.payload);\nmsg.topic = \"Eng\";\nvar T =  numInput-273.15;\nmsg.payload = T.toFixed(1);\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 850,
       "y": 345,
       "wires": [
           [
               "acffaa91.dcbd08"
           ]
       ]
   },
   {
       "id": "4439e0f6.da26d",
       "type": "ui_gauge",
       "z": "749e8283.293f4c",
       "name": "BattVoltGauge",
       "group": "3bc70d31.720c02",
       "order": 1,
       "width": "3",
       "height": "4",
       "gtype": "gage",
       "title": "Battery Voltage",
       "label": "mV",
       "format": "{{value}}",
       "min": "11",
       "max": "16",
       "colors": [
           "#ff0000",
           "#3ad90d",
           "#ca3838"
       ],
       "seg1": "12.5",
       "seg2": "14.9",
       "x": 1060,
       "y": 420,
       "wires": []
   },
   {
       "id": "2af10602.ee0eca",
       "type": "ui_text",
       "z": "749e8283.293f4c",
       "group": "3bc70d31.720c02",
       "order": 0,
       "width": 0,
       "height": 0,
       "name": "Pressure",
       "label": "Pressure",
       "format": "{{msg.payload}}",
       "layout": "row-spread",
       "x": 1040,
       "y": 500,
       "wires": []
   },
   {
       "id": "985338c6.d20748",
       "type": "ui_chart",
       "z": "749e8283.293f4c",
       "name": "EngineGraph",
       "group": "839affdb.33ce",
       "order": 0,
       "width": "23",
       "height": "7",
       "label": "Engine temperature history",
       "chartType": "line",
       "legend": "true",
       "xformat": "HH:mm",
       "interpolate": "linear",
       "nodata": "data",
       "ymin": "",
       "ymax": "",
       "removeOlder": "12",
       "removeOlderPoints": "",
       "removeOlderUnit": "3600",
       "cutout": "",
       "colors": [
           "#1f77b4",
           "#aec7e8",
           "#ff7f0e",
           "#2ca02c",
           "#98df8a",
           "#d62728",
           "#ff9896",
           "#9467bd",
           "#c5b0d5"
       ],
       "x": 1060,
       "y": 145,
       "wires": [
           [],
           []
       ]
   },
   {
       "id": "f66f5fb8.176a1",
       "type": "ui_gauge",
       "z": "749e8283.293f4c",
       "name": "EngTempGauge",
       "group": "3bc70d31.720c02",
       "order": 1,
       "width": "3",
       "height": "4",
       "gtype": "gage",
       "title": "Engine temperature",
       "label": "Deg C",
       "format": "{{value}}",
       "min": 0,
       "max": "120",
       "colors": [
           "#00b500",
           "#e6e600",
           "#ca3838"
       ],
       "seg1": "",
       "seg2": "",
       "x": 1060,
       "y": 185,
       "wires": []
   },
   {
       "id": "c64d6283.aca53",
       "type": "ui_chart",
       "z": "749e8283.293f4c",
       "name": "Alt graph",
       "group": "839affdb.33ce",
       "order": 0,
       "width": "23",
       "height": "7",
       "label": "Alt temperature history",
       "chartType": "line",
       "legend": "false",
       "xformat": "HH:mm",
       "interpolate": "linear",
       "nodata": "",
       "ymin": "",
       "ymax": "",
       "removeOlder": "12",
       "removeOlderPoints": "",
       "removeOlderUnit": "3600",
       "cutout": "",
       "colors": [
           "#1f77b4",
           "#aec7e8",
           "#ff7f0e",
           "#2ca02c",
           "#98df8a",
           "#d62728",
           "#ff9896",
           "#9467bd",
           "#c5b0d5"
       ],
       "x": 1040,
       "y": 225,
       "wires": [
           [],
           []
       ]
   },
   {
       "id": "2e9c3f90.ea532",
       "type": "ui_gauge",
       "z": "749e8283.293f4c",
       "name": "AltTempGauge",
       "group": "3bc70d31.720c02",
       "order": 1,
       "width": "3",
       "height": "4",
       "gtype": "gage",
       "title": "Alt  temperature",
       "label": "Deg C",
       "format": "{{value}}",
       "min": 0,
       "max": "120",
       "colors": [
           "#00b500",
           "#e6e600",
           "#ca3838"
       ],
       "seg1": "",
       "seg2": "",
       "x": 1060,
       "y": 265,
       "wires": []
   },
   {
       "id": "9ca91b03.6c5c38",
       "type": "ui_chart",
       "z": "749e8283.293f4c",
       "name": "ExhGraph",
       "group": "839affdb.33ce",
       "order": 0,
       "width": "23",
       "height": "7",
       "label": "Exh temperature history",
       "chartType": "line",
       "legend": "false",
       "xformat": "HH:mm",
       "interpolate": "linear",
       "nodata": "waiting",
       "ymin": "",
       "ymax": "",
       "removeOlder": "12",
       "removeOlderPoints": "",
       "removeOlderUnit": "3600",
       "cutout": "",
       "colors": [
           "#1f77b4",
           "#aec7e8",
           "#ff7f0e",
           "#2ca02c",
           "#98df8a",
           "#d62728",
           "#ff9896",
           "#9467bd",
           "#c5b0d5"
       ],
       "x": 1040,
       "y": 305,
       "wires": [
           [],
           []
       ]
   },
   {
       "id": "acffaa91.dcbd08",
       "type": "ui_gauge",
       "z": "749e8283.293f4c",
       "name": "ExhTempGauge",
       "group": "3bc70d31.720c02",
       "order": 1,
       "width": "3",
       "height": "4",
       "gtype": "gage",
       "title": "Exhaust temperature",
       "label": "Deg C",
       "format": "{{value}}",
       "min": 0,
       "max": "120",
       "colors": [
           "#00b500",
           "#e6e600",
           "#ca3838"
       ],
       "seg1": "",
       "seg2": "",
       "x": 1060,
       "y": 345,
       "wires": []
   },
   {
       "id": "fc1b2b62.0b63a8",
       "type": "websocket-listener",
       "z": "",
       "path": "ws://localhost:3000/signalk/v1/stream",
       "wholemsg": "false"
   },
   {
       "id": "3bc70d31.720c02",
       "type": "ui_group",
       "z": "",
       "name": "Gauges",
       "tab": "de6fba2.670c748",
       "disp": true,
       "width": "6"
   },
   {
       "id": "839affdb.33ce",
       "type": "ui_group",
       "z": "",
       "name": "Eng Temp Graphs",
       "tab": "9ba2713.ee8369",
       "disp": true,
       "width": "23"
   },
   {
       "id": "de6fba2.670c748",
       "type": "ui_tab",
       "z": "",
       "name": "Gauges",
       "icon": "dashboard",
       "order": 1
   },
   {
       "id": "9ba2713.ee8369",
       "type": "ui_tab",
       "z": "",
       "name": "Graphs",
       "icon": "dashboard",
       "order": 2
   }
]
Reply


Messages In This Thread
Node-RED - Serial Nodes - by abarrow - 2017-10-11, 10:18 PM
RE: Node-RED - Serial Nodes - by Sailoog - 2017-10-12, 01:01 PM
RE: Node-RED - Serial Nodes - by abarrow - 2017-10-12, 01:30 PM
RE: Node-RED - Serial Nodes - by shark24 - 2017-10-12, 02:36 PM
RE: Node-RED - Serial Nodes - by Lazzz - 2017-10-14, 04:45 AM
RE: Node-RED - Serial Nodes - by abarrow - 2017-10-12, 02:49 PM
RE: Node-RED - Serial Nodes - by PaddyB - 2017-10-12, 03:14 PM
RE: Node-RED - Serial Nodes - by abarrow - 2017-10-13, 01:40 PM
RE: Node-RED - Serial Nodes - by PaddyB - 2017-10-13, 02:05 PM
RE: Node-RED - Serial Nodes - by Sailoog - 2017-10-13, 04:28 PM
RE: Node-RED - Serial Nodes - by PaddyB - 2017-10-14, 11:31 AM
RE: Node-RED - Serial Nodes - by Sailoog - 2017-10-16, 11:29 AM
Node-RED - Serial Nodes - by Alpenskipper - 2017-10-16, 05:45 AM
RE: Node-RED - Serial Nodes - by Sailoog - 2017-10-18, 05:59 PM
RE: Node-RED - Serial Nodes - by Sailoog - 2018-01-03, 07:07 PM
RE: Node-RED - Serial Nodes - by pcmm - 2018-04-30, 07:51 PM
RE: Node-RED - Serial Nodes - by jim321 - 2018-04-30, 07:59 PM
RE: Node-RED - Serial Nodes - by pcmm - 2018-04-30, 08:53 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)