Good evening everyone
I noticed a strange behaviour with my join node, probably I misconfigured it.
The flow gets a message with GPS data, extract latitude and longitude in two different branches and then I join them together to make a single message
The problem is, I have no idea why but I'm getting 2 messages at the same time (with slightly different data). I tought about the flag of the 2 message parts but I think that's correct? I need both messages to get a full position
Probably I'm doing something stupid, any help is appreciated
[
{
"id": "bbaab412081cb0ee",
"type": "function",
"z": "3af70a9829406ec3",
"name": "NMEA to human",
"func": "let pos = msg.payload.indexOf(\".\")\nlet minutes = msg.payload.substring(pos-2)\nlet degrees = msg.payload.substring(0, pos-2)\nlet temp = Number(degrees) + (Number(minutes)/60)\nmsg.payload = temp\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"y": 580,
"wires": [
[
"2987fe00cd334ebd"
]
]
},
{
"id": "5ad5ec586f14b9ed",
"type": "function",
"z": "3af70a9829406ec3",
"name": "NMEA to human",
"func": "let pos = msg.payload.indexOf(\".\")\nlet minutes = msg.payload.substring(pos-2)\nlet degrees = msg.payload.substring(0, pos-2)\nlet temp = Number(degrees) + (Number(minutes)/60)\nmsg.payload = temp\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"y": 540,
"wires": [
[
"bf24f301c2e25934"
]
]
},
{
"id": "60010beafd8ae5b9",
"type": "string",
"z": "3af70a9829406ec3",
"name": "filter E",
"methods": [
{
"name": "between",
"params": [
{
"type": "str",
"value": "N,"
},
{
"type": "str",
"value": ",E,"
}
]
}
],
"prop": "payload",
"propout": "payload",
"object": "msg",
"objectout": "msg",
"x": 350,
"y": 580,
"wires": [
[
"bbaab412081cb0ee"
]
]
},
{
"id": "640a1bbc0b9213ac",
"type": "string",
"z": "3af70a9829406ec3",
"name": "filter N",
"methods": [
{
"name": "between",
"params": [
{
"type": "str",
"value": "+CGPSINFO:"
},
{
"type": "str",
"value": ",N,"
}
]
}
],
"prop": "payload",
"propout": "payload",
"object": "msg",
"objectout": "msg",
"x": 350,
"y": 540,
"wires": [
[
"5ad5ec586f14b9ed"
]
]
},
{
"id": "2987fe00cd334ebd",
"type": "change",
"z": "3af70a9829406ec3",
"name": "set topic: E",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "E",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 730,
"y": 580,
"wires": [
[
"5e6e5576958b3129"
]
]
},
{
"id": "bf24f301c2e25934",
"type": "change",
"z": "3af70a9829406ec3",
"name": "set topic: N",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "N",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 730,
"y": 540,
"wires": [
[
"5e6e5576958b3129"
]
]
},
{
"id": "5e6e5576958b3129",
"type": "join",
"z": "3af70a9829406ec3",
"name": "Join topics",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": true,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 910,
"y": 560,
"wires": [
[
"979d4f7a4b2d18f9"
]
]
},
{
"id": "979d4f7a4b2d18f9",
"type": "function",
"z": "3af70a9829406ec3",
"name": "Merge to string",
"func": "let temp = \"{ \\\"type\\\":\\\"Point\\\",\\\"coordinates\\\": [\" + msg.payload.E + \", \" + msg.payload.N + \"]}\"\nmsg.payload = temp\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1100,
"y": 560,
"wires": [
[
"225754e90cfb26c4",
"d8efe248e1a37329"
]
]
}
]
Thanks
P