2020-05-25, 03:38 AM
here's a little node-red which sends your VWT speed to environment/wind/speedTrue and angle to environment/wind/angleTrueGround, should work >
Code:
[
{
"id": "485c6a6a.b30564",
"type": "tcp in",
"z": "1ffaa926.033937",
"name": "",
"server": "client",
"host": "10.10.10.1",
"port": "10110",
"datamode": "stream",
"datatype": "utf8",
"newline": "",
"topic": "",
"base64": false,
"x": 220,
"y": 640,
"wires": [
[
"3141d807.47a188"
]
]
},
{
"id": "3141d807.47a188",
"type": "switch",
"z": "1ffaa926.033937",
"name": "Filter just pressure",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "regex",
"v": "^(?=.*IIVWT)",
"vt": "str",
"case": false
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 290,
"y": 720,
"wires": [
[
"44800ded.615034",
"c5daff41.52d96"
]
]
},
{
"id": "44800ded.615034",
"type": "function",
"z": "1ffaa926.033937",
"name": "",
"func": "msg.split = msg.payload.split(',');\nmsg.angle = msg.split[1] * 3.14 / 180;\nmsg.speed = msg.split[5];\nif (msg.split[2] != 'R') {\n msg.angle = msg.angle * -1;\n}\nmsg.topic = 'environment/wind/angleTrueGround'\nmsg.payload = msg.angle;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 500,
"y": 680,
"wires": [
[
"1f3f4db4.1f3cf2"
]
]
},
{
"id": "c5daff41.52d96",
"type": "function",
"z": "1ffaa926.033937",
"name": "",
"func": "msg.split = msg.payload.split(',');\nmsg.angle = msg.split[1] * 3.14 / 180;\nmsg.speed = msg.split[5];\nif (msg.split[2] == 'R') {\n msg.angle = msg.angle * -1;\n}\nmsg.topic = 'environment/wind/speedTrue'\nmsg.payload = msg.speed;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 510,
"y": 740,
"wires": [
[
"10c8a381.61f7fc"
]
]
},
{
"id": "1f3f4db4.1f3cf2",
"type": "signalk-send-pathvalue",
"z": "1ffaa926.033937",
"name": "",
"source": "",
"x": 830,
"y": 680,
"wires": []
},
{
"id": "10c8a381.61f7fc",
"type": "signalk-send-pathvalue",
"z": "1ffaa926.033937",
"name": "",
"source": "",
"x": 810,
"y": 740,
"wires": []
}
]