Hello,
I am receiving two messages from different nodes from plc and I need to set it to two different variables.
But its not working as planned.
To have a better understanding there is an example flow below. Do someone know how to do this?
I am supposed to get "car" : 7 and "bike" : 8.
But I am getting only bike value.
[
{
"id": "ab9a0a1cbf6d3818",
"type": "inject",
"z": "ea47a1366397a64c",
"name": "",
"props": [
{
"p": "payload.jam",
"v": "7",
"vt": "num"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 160,
"y": 120,
"wires": [
[
"b934d88217fe9eed"
]
]
},
{
"id": "0d591409cde875ca",
"type": "inject",
"z": "ea47a1366397a64c",
"name": "",
"props": [
{
"p": "payload.jam",
"v": "8",
"vt": "num"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 160,
"y": 200,
"wires": [
[
"3eb1401e4f4bfc48"
]
]
},
{
"id": "3eb1401e4f4bfc48",
"type": "function",
"z": "ea47a1366397a64c",
"name": "function 123",
"func": "flow.set(\"car\", msg.topic);\nx=flow.get(\"car\")\n\nflow.set(\"bike\",msg.payload.jam);\nx = flow.get(\"bike\")\nreturn msg;",
"outputs": 1,
"noerr": 2,
"initialize": "",
"finalize": "",
"libs": [],
"x": 670,
"y": 120,
"wires": [
[
"370bec198f8ba585"
]
]
},
{
"id": "b934d88217fe9eed",
"type": "change",
"z": "ea47a1366397a64c",
"name": "",
"rules": [
{
"t": "move",
"p": "payload.jam",
"pt": "msg",
"to": "topic",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 390,
"y": 120,
"wires": [
[
"3eb1401e4f4bfc48",
"78fed6e97b9643f4"
]
]
},
{
"id": "78fed6e97b9643f4",
"type": "debug",
"z": "ea47a1366397a64c",
"name": "debug 20",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 340,
"y": 40,
"wires": []
},
{
"id": "370bec198f8ba585",
"type": "debug",
"z": "ea47a1366397a64c",
"name": "debug 21",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 870,
"y": 120,
"wires": []
}
]