I require assistance with my existing workflow. The objective is to duplicate a camera image from an FTP location to a local one. The local destination should only contain two types of images: the regular camera image and the textured camera image. Subsequently, the local images should be transferred to a new FTP using the data name from the source path. Following this, the source path should delete the image. It is worth noting that triggering the process results in obtaining two images: the textured image and the regular image.
Here my Flow:
[
{
"id": "0e7e414cf9817c49",
"type": "function",
"z": "09b8638e2f511e95",
"name": "FTP List",
"func": "msg.host = \"192.168.0.1\";\nmsg.port = 21;\nmsg.user = \"user12\";\nmsg.password = \"pass\";\nmsg.operation = \"LIST\";\nmsg.filename = \"/File/\";\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 700,
"y": 520,
"wires": [
[
"1ff00035aafc8b87"
]
]
},
{
"id": "1ff00035aafc8b87",
"type": "ftp",
"z": "09b8638e2f511e95",
"name": "FTP LIST",
"x": 880,
"y": 520,
"wires": [
[
"7b9411f132639055",
"6aad94dcf8d25c7e"
]
]
},
{
"id": "7b9411f132639055",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 44",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1060,
"y": 520,
"wires": []
},
{
"id": "1fb29a0b762626ec",
"type": "inject",
"z": "09b8638e2f511e95",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "timestamp",
"payloadType": "str",
"x": 480,
"y": 520,
"wires": [
[
"0e7e414cf9817c49"
]
]
},
{
"id": "6aad94dcf8d25c7e",
"type": "function",
"z": "09b8638e2f511e95",
"name": "FTP List Unterordner",
"func": "global.set(\"PL12subfolder\", msg.payload[0].name)\nmsg.host = \"192.168.0.2\";\nmsg.port = 21;\nmsg.user = \"user12\";\nmsg.password = \"pass\";\nmsg.operation = \"LIST\";\nmsg.filename = \"/File/\" + msg.payload[0].name + \"/\"; // File/Date/\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1320,
"y": 520,
"wires": [
[
"b55f368bff29971a",
"3eb85fc943646f60"
]
]
},
{
"id": "b55f368bff29971a",
"type": "ftp",
"z": "09b8638e2f511e95",
"name": "FTP LIST",
"x": 1520,
"y": 520,
"wires": [
[
"9264249947734336",
"9c4457ba05aefa44"
]
]
},
{
"id": "3759051461f9c621",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 45",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3020,
"y": 800,
"wires": []
},
{
"id": "9264249947734336",
"type": "function",
"z": "09b8638e2f511e95",
"name": "FTP GET Normal",
"func": "\n\nfor (let i = 0; i < msg.payload.length; i++) {\n if (msg.payload.includes(\"CAM_Normal\")) {\n let file = \"/File/\" + global.get(\"PL12subfolder\") + \"/\" + msg.payload[i].name;\n global.set(\"CurrentData_N\", msg.payload[i].name);\n global.set(\"CurrentSourcePath\", file);\n\n msg.host = \"192.168.0.1\";\n msg.port = 21;\n msg.user = \"user12\";\n msg.password = \"pass\";\n msg.operation = \"GET\";\n msg.filename = file;\n msg.localFilename = \"/home/Folder/pic/normal.\" + msg.payload[i].name;\n }\n}\nreturn msg;\n\n\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1750,
"y": 520,
"wires": [
[
"b7f70e051031b7d5"
]
]
},
{
"id": "e1e6dcbe7937d7e0",
"type": "image viewer",
"z": "09b8638e2f511e95",
"name": "Normal_viewer",
"width": "1090",
"data": "payload",
"dataType": "msg",
"active": true,
"x": 3040,
"y": 840,
"wires": [
[]
]
},
{
"id": "b7f70e051031b7d5",
"type": "ftp",
"z": "09b8638e2f511e95",
"name": "FTP GET",
"x": 2000,
"y": 520,
"wires": [
[
"e894a1123e8edda3",
"976b9bf8bc882721"
]
]
},
{
"id": "e6e4e6d279deb301",
"type": "file in",
"z": "09b8638e2f511e95",
"name": "",
"filename": "/home/folder/pic/Normal_cam.jpg",
"filenameType": "str",
"format": "",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 2720,
"y": 780,
"wires": [
[
"e1e6dcbe7937d7e0",
"3759051461f9c621",
"e6dceb8ed397fe5b"
]
]
},
{
"id": "e894a1123e8edda3",
"type": "change",
"z": "09b8638e2f511e95",
"name": "",
"rules": [
{
"t": "delete",
"p": "filename",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2420,
"y": 520,
"wires": [
[
"e6e4e6d279deb301",
"64ceb40b5fdee944"
]
]
},
{
"id": "976b9bf8bc882721",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 46",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2200,
"y": 520,
"wires": []
},
{
"id": "3eb85fc943646f60",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 47",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1520,
"y": 480,
"wires": []
},
{
"id": "e6dceb8ed397fe5b",
"type": "function",
"z": "09b8638e2f511e95",
"name": "FTP PUT Normal",
"func": "\n\nmsg.host = \"192.168.168.1\";\nmsg.port = 21;\nmsg.user = \"user45\";\nmsg.password = \"pass45\";\nmsg.operation = \"PUT\";\nmsg.filename = \"/PL12_VkMag_OCR/Normal.\" + global.get(\"CurrentData_N\");\nmsg.localFilename = \"/home/eeu/pic/PL12_VK_Mag_Keyence/normal.jpg\";\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 3330,
"y": 780,
"wires": [
[
"49add75119c55262",
"fbc10b211041bd98"
]
]
},
{
"id": "49add75119c55262",
"type": "ftp",
"z": "09b8638e2f511e95",
"name": "FTP PUT Normal",
"x": 3710,
"y": 780,
"wires": [
[
"a404f1d683dd75f3",
"8971d54a8dc5a615"
]
]
},
{
"id": "a404f1d683dd75f3",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 48",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 3680,
"y": 720,
"wires": []
},
{
"id": "fbc10b211041bd98",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 49",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 3300,
"y": 720,
"wires": []
},
{
"id": "8971d54a8dc5a615",
"type": "function",
"z": "09b8638e2f511e95",
"name": "FTP DELETE",
"func": " let file = global.get(\"CurrentSourcePath\");\n\n msg.host = \"192.168.0.1\";\n msg.port = 21;\n msg.user = \"user12\";\n msg.password = \"pass\";\n msg.operation = \"DELETE\";\n msg.filename = file;\n \nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 3320,
"y": 820,
"wires": [
[
"f94b6fa7811d5293"
]
]
},
{
"id": "f94b6fa7811d5293",
"type": "ftp",
"z": "09b8638e2f511e95",
"name": "FTP Texture Delete",
"x": 3710,
"y": 820,
"wires": [
[
"a0e1d63b155fd045"
]
]
},
{
"id": "a0e1d63b155fd045",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 50",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 3680,
"y": 880,
"wires": []
},
{
"id": "709d77ed12fdfe12",
"type": "function",
"z": "09b8638e2f511e95",
"name": "FTP PUT Texture",
"func": "\n\nmsg.host = \"192.168.168.1\";\nmsg.port = 21;\nmsg.user = \"user45\";\nmsg.password = \"pass45\";\nmsg.operation = \"DELETE\";\nmsg.filename = \"/PL12_VkMag_OCR/Texture.\" + global.get(\"CurrentData_T\");\nmsg.localFilename = \"/home/eeu/pic/PL12_VK_Mag_Keyence/texture.jpg\";\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 3310,
"y": 520,
"wires": [
[
"4b1005f411b29095",
"6acb924e67911309"
]
]
},
{
"id": "4b1005f411b29095",
"type": "ftp",
"z": "09b8638e2f511e95",
"name": "FTP PUT Texture",
"x": 3710,
"y": 520,
"wires": [
[
"b10e27731810c6e0",
"2d5bb472a178910b"
]
]
},
{
"id": "b10e27731810c6e0",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 51",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 3680,
"y": 460,
"wires": []
},
{
"id": "6acb924e67911309",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 52",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 3280,
"y": 460,
"wires": []
},
{
"id": "2d5bb472a178910b",
"type": "function",
"z": "09b8638e2f511e95",
"name": "FTP DELETE Texture",
"func": " let file = global.get(\"CurrentSourcePath\");\n\n msg.host = \"192.168.0.1\";\n msg.port = 21;\n msg.user = \"user12\";\n msg.password = \"pass\";\n msg.operation = \"DELETE\";\n msg.filename = file;\n \nreturn msg;\n\n\n\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 3320,
"y": 560,
"wires": [
[
"e093c8bab035b7e0"
]
]
},
{
"id": "e093c8bab035b7e0",
"type": "ftp",
"z": "09b8638e2f511e95",
"name": "FTP Normal Delete",
"x": 3710,
"y": 560,
"wires": [
[
"3af5796e58dcd6c3"
]
]
},
{
"id": "3af5796e58dcd6c3",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 53",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 3680,
"y": 620,
"wires": []
},
{
"id": "64ceb40b5fdee944",
"type": "file in",
"z": "09b8638e2f511e95",
"name": "",
"filename": "/home/folder/pic/Texture_cam.jpg",
"filenameType": "str",
"format": "",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 2720,
"y": 520,
"wires": [
[
"709d77ed12fdfe12",
"6b87dd05eaad64d6",
"498add32e38c4b2d"
]
]
},
{
"id": "6b87dd05eaad64d6",
"type": "debug",
"z": "09b8638e2f511e95",
"name": "debug 54",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3020,
"y": 540,
"wires": []
},
{
"id": "498add32e38c4b2d",
"type": "image viewer",
"z": "09b8638e2f511e95",
"name": "Texture_viewer",
"width": "1090",
"data": "payload",
"dataType": "msg",
"active": true,
"x": 3040,
"y": 580,
"wires": [
[]
]
},
{
"id": "9c4457ba05aefa44",
"type": "function",
"z": "09b8638e2f511e95",
"name": "FTP GET Texture",
"func": "\n\n\n\nfor (let i = 0; i < msg.payload.length; i++) {\n\n if (msg.payload.includes(\"CAM_Texture\")) { // If Datapath contains String (\"CAM_Texture\") \n let file = \"/File/\" + global.get(\"PL12subfolder\") + \"/\" + msg.payload[i].name;\n global.set(\"CurrentData_T\", msg.payload[i].name);\n global.set(\"CurrentSourcePath\", file);\n\n\n msg.host = \"192.168.0.1\";\n msg.port = 21;\n msg.user = \"user12\";\n msg.password = \"pass\";\n msg.operation = \"GET\";\n msg.filename = file;\n msg.localFilename = \"/home/Folder/pic/texture.\" + msg.payload[i].name;\n }\n}\n\nreturn msg;\nmsg.host = \"192.168.0.1\";\nmsg.port = 21;\nmsg.user = \"user12\";\nmsg.password = \"pass\";",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1750,
"y": 560,
"wires": [
[
"b7f70e051031b7d5"
]
]
}
]