2016-12-14, 11:47 PM
(2016-12-14, 04:33 PM)gniersma Wrote: My question now is is it also possible to write to the Signal-K on openplotter ?Yes. There is no special port for this. For notifications you should use 55558. For other sensor use 55559.
I see that there are several Input UDP ports defined in openplotter. But not specifically for node Red.
Somebody knows this and has an example ?
Here is an example to send RPI cpu temperature to SignalK as 'environment.inside.heating.temperature'
Code:
[{
"id": "f5fa759f.be894",
"type": "inject",
"z": "4deb498f.fbcfd8",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "5",
"crontab": "",
"once": true,
"x": 134,
"y": 120,
"wires": [["adb4b4a8.9c10c8"]]
}, {
"id": "adb4b4a8.9c10c8",
"type": "exec",
"z": "4deb498f.fbcfd8",
"command": "vcgencmd",
"addpay": false,
"append": "measure_temp",
"useSpawn": "",
"timer": "",
"name": "getCPUtemp",
"x": 323,
"y": 161.5,
"wires": [["2705f134.792f86"], [], []]
}, {
"id": "7b5088a.c5f0af8",
"type": "debug",
"z": "4deb498f.fbcfd8",
"name": "",
"active": false,
"console": "false",
"complete": "payload",
"x": 740,
"y": 147.5,
"wires": []
}, {
"id": "2705f134.792f86",
"type": "function",
"z": "4deb498f.fbcfd8",
"name": "msg.payload",
"func": "cpu_temp = parseFloat(msg.payload.replace(\"temp=\",\"\").replace(\"'C\\n\",\"\"));\ncpu_temp = cpu_temp + 273.15\nmsg.payload = '{\\\"updates\\\": [{\\\"source\\\": {\\\"type\\\": \\\"ARMTEMP\\\",\\\"src\\\" : \\\"RPIMCU\\\"},\\\"values\\\":[{\\\"path\\\": \\\"environment.inside.heating.temperature\\\",\\\"value\\\":'+cpu_temp+'}]}]}\\n';\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 533,
"y": 210,
"wires": [["7b5088a.c5f0af8", "c17f4c75.737088"]]
}, {
"id": "c17f4c75.737088",
"type": "udp out",
"z": "4deb498f.fbcfd8",
"name": "sendSK",
"addr": "localhost",
"iface": "",
"port": "55559",
"ipv": "udp4",
"outport": "",
"base64": false,
"multicast": "false",
"x": 742,
"y": 221,
"wires": []
}
]