There is. As already explained, the LinkCall
/ LinkOut
core nodes provide this functionality.
It's setup like this:
Flow:
[
{
"id": "5ea31b0cb5dea699",
"type": "tab",
"label": "Flow 9",
"disabled": false,
"info": "",
"env": [],
"_mcu": {
"mcu": false
}
},
{
"id": "e2e2f772a1eff8f6",
"type": "inject",
"z": "5ea31b0cb5dea699",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "10",
"payloadType": "num",
"_mcu": {
"mcu": false
},
"x": 170,
"y": 180,
"wires": [
[
"e94b8d48fd6572be"
]
]
},
{
"id": "e94b8d48fd6572be",
"type": "link call",
"z": "5ea31b0cb5dea699",
"name": "",
"links": [
"1944c969ede348f0"
],
"linkType": "static",
"timeout": "30",
"_mcu": {
"mcu": false
},
"x": 340,
"y": 180,
"wires": [
[
"b8df104959731e08"
]
]
},
{
"id": "1944c969ede348f0",
"type": "link in",
"z": "5ea31b0cb5dea699",
"name": "Call Me",
"links": [],
"_mcu": {
"mcu": false
},
"x": 150,
"y": 360,
"wires": [
[
"de509aa2a88babcc"
]
],
"l": true
},
{
"id": "de509aa2a88babcc",
"type": "function",
"z": "5ea31b0cb5dea699",
"name": "payload * 2",
"func": "msg.payload *= 2;\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"_mcu": {
"mcu": false
},
"x": 310,
"y": 360,
"wires": [
[
"ea769cc1776c3305"
]
]
},
{
"id": "ea769cc1776c3305",
"type": "link out",
"z": "5ea31b0cb5dea699",
"name": "link out 4",
"mode": "return",
"links": [],
"_mcu": {
"mcu": false
},
"x": 435,
"y": 360,
"wires": []
},
{
"id": "b8df104959731e08",
"type": "debug",
"z": "5ea31b0cb5dea699",
"name": "=> Debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"_mcu": {
"mcu": false
},
"x": 500,
"y": 180,
"wires": []
},
{
"id": "516b3e5fa463a95c",
"type": "inject",
"z": "5ea31b0cb5dea699",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "25",
"payloadType": "num",
"_mcu": {
"mcu": false
},
"x": 170,
"y": 240,
"wires": [
[
"4542b0fc3a8073cb"
]
]
},
{
"id": "4542b0fc3a8073cb",
"type": "link call",
"z": "5ea31b0cb5dea699",
"name": "",
"links": [
"1944c969ede348f0"
],
"linkType": "static",
"timeout": "30",
"_mcu": {
"mcu": false
},
"x": 340,
"y": 240,
"wires": [
[
"ce3825622b5df917"
]
]
},
{
"id": "ce3825622b5df917",
"type": "debug",
"z": "5ea31b0cb5dea699",
"name": "=> Debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"_mcu": {
"mcu": false
},
"x": 500,
"y": 240,
"wires": []
},
{
"id": "58e5a97758e7a7c0",
"type": "comment",
"z": "5ea31b0cb5dea699",
"name": "This behaves like a standard sub-routine",
"info": "",
"_mcu": {
"mcu": false
},
"x": 260,
"y": 320,
"wires": []
}
]
No need for any hack!