OpenMarine
How to publish a timestamp/ environment.time? - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3)
+--- Thread: How to publish a timestamp/ environment.time? (/showthread.php?tid=755)



How to publish a timestamp/ environment.time? - Alpenskipper - 2017-09-11

Hi!
For an airpressure chart, I would need the local time (the time of the raspberry pi, no nmea sequences with a time string available ).
How can the internal raspberry pi time be published in OP?
Martin


RE: How to publish a timestamp/ environment.time? - PaddyB - 2017-09-11

(2017-09-11, 10:31 AM)Alpenskipper Wrote: Hi!
For an airpressure chart, I would need the local time (the time of the raspberry pi, no nmea sequences with a time string available ).
How can the internal raspberry pi time be published in OP?
Martin

Node red has a chart node which does all that for you.

Something like...(The limit node would be better set to something like 1 per minute)

Code:
[
   {
       "id": "747c2583.7cc55c",
       "type": "websocket in",
       "z": "c9b82bf0.2e8e78",
       "name": "SignalK input",
       "server": "d4503be4.7ab258",
       "client": "",
       "x": 130,
       "y": 80,
       "wires": [
           [
               "f40c5860.801988"
           ]
       ]
   },
   {
       "id": "f40c5860.801988",
       "type": "json",
       "z": "c9b82bf0.2e8e78",
       "name": "",
       "pretty": false,
       "x": 250,
       "y": 120,
       "wires": [
           [
               "97e64833.127fa8"
           ]
       ]
   },
   {
       "id": "97e64833.127fa8",
       "type": "switch",
       "z": "c9b82bf0.2e8e78",
       "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": 360,
       "y": 200,
       "wires": [
           [
               "33642b2d.aa92d4"
           ]
       ]
   },
   {
       "id": "33642b2d.aa92d4",
       "type": "change",
       "z": "c9b82bf0.2e8e78",
       "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": 330,
       "y": 300,
       "wires": [
           [
               "f47dd59d.508d18",
               "2e555623.d43aba",
               "ba9d42d3.142ae"
           ]
       ]
   },
   {
       "id": "f47dd59d.508d18",
       "type": "delay",
       "z": "c9b82bf0.2e8e78",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "second",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 510,
       "y": 260,
       "wires": [
           [
               "1e715698.7829e9"
           ]
       ]
   },
   {
       "id": "1e715698.7829e9",
       "type": "ui_text",
       "z": "c9b82bf0.2e8e78",
       "group": "78fc673a.a74ed8",
       "order": 0,
       "width": 0,
       "height": 0,
       "name": "Pressure",
       "label": "Pressure",
       "format": "{{msg.payload}}",
       "layout": "row-spread",
       "x": 660,
       "y": 200,
       "wires": []
   },
   {
       "id": "2e555623.d43aba",
       "type": "debug",
       "z": "c9b82bf0.2e8e78",
       "name": "",
       "active": true,
       "console": "false",
       "complete": "false",
       "x": 490,
       "y": 380,
       "wires": []
   },
   {
       "id": "ba9d42d3.142ae",
       "type": "delay",
       "z": "c9b82bf0.2e8e78",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "second",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 550,
       "y": 300,
       "wires": [
           [
               "6d0fb71d.7c2098"
           ]
       ]
   },
   {
       "id": "6d0fb71d.7c2098",
       "type": "ui_chart",
       "z": "c9b82bf0.2e8e78",
       "name": "",
       "group": "78fc673a.a74ed8",
       "order": 0,
       "width": 0,
       "height": 0,
       "label": "chart",
       "chartType": "line",
       "legend": "false",
       "xformat": "HH:mm:ss",
       "interpolate": "linear",
       "nodata": "",
       "dot": false,
       "ymin": "",
       "ymax": "",
       "removeOlder": 1,
       "removeOlderPoints": "",
       "removeOlderUnit": "3600",
       "cutout": 0,
       "colors": [
           "#1f77b4",
           "#aec7e8",
           "#ff7f0e",
           "#2ca02c",
           "#98df8a",
           "#d62728",
           "#ff9896",
           "#9467bd",
           "#c5b0d5"
       ],
       "x": 720,
       "y": 320,
       "wires": [
           [],
           []
       ]
   },
   {
       "id": "d4503be4.7ab258",
       "type": "websocket-listener",
       "z": "",
       "path": "ws://localhost:3000/signalk/v1/stream",
       "wholemsg": "false"
   },
   {
       "id": "78fc673a.a74ed8",
       "type": "ui_group",
       "z": "",
       "name": "Gauges",
       "tab": "2b930b0f.158ef4",
       "disp": true,
       "width": "6"
   },
   {
       "id": "2b930b0f.158ef4",
       "type": "ui_tab",
       "z": "",
       "name": "Gauges",
       "icon": "dashboard",
       "order": 1
   }
]

[Image: aDDXVl4.png]


RE: How to publish a timestamp/ environment.time? - Alpenskipper - 2017-09-11

Hi PaddyB,

Thank you for pointing me in the direction of node red. As I am more a sailor than a IT technician :-) , I never used node red before and I guess, I won't be capable to use it.
I use OP mostly for remote monitoring my boat, when I am at home. I only have a GSM net, so I can't forward ports.
Data is transmitted via MQTT and displayed in an freeboard dashboard. That seemed the easiest way until now.
A timestamp would be useful for serveral things.
Martin