[
   {
       "id": "b822a5c6e6e5a711",
       "type": "buffer-maker",
       "z": "385f4b8d434f6005",
       "name": "type, ID und Passwort",
       "specification": "spec",
       "specificationType": "ui",
       "items": [
           {
               "name": "type",
               "type": "buffer",
               "length": 1,
               "dataType": "bin",
               "data": "[2]"
           },
           {
               "name": "sizeID",
               "type": "buffer",
               "length": 1,
               "dataType": "bin",
               "data": "[16]"
           },
           {
               "name": "ID",
               "type": "string",
               "length": 16,
               "dataType": "msg",
               "data": "ID"
           },
           {
               "name": "sizePWD",
               "type": "byte",
               "length": 1,
               "dataType": "jsonata",
               "data": "$length(password)"
           },
           {
               "name": "password",
               "type": "string",
               "length": -1,
               "dataType": "msg",
               "data": "password"
           }
       ],
       "swap1": "",
       "swap2": "",
       "swap3": "",
       "swap1Type": "swap",
       "swap2Type": "swap",
       "swap3Type": "swap",
       "msgProperty": "payload",
       "msgPropertyType": "str",
       "x": 340,
       "y": 80,
       "wires": [
           [
               "f8c660323b580df5"
           ]
       ]
   },
   {
       "id": "929cad4e0b9a7443",
       "type": "inject",
       "z": "385f4b8d434f6005",
       "name": "",
       "props": [
           {
               "p": "ID",
               "v": "",
               "vt": "str"
           },
           {
               "p": "password",
               "v": "1111",
               "vt": "str"
           },
           {
               "p": "FUNC",
               "v": "1",
               "vt": "num"
           },
           {
               "p": "DATA",
               "v": "[1,2]",
               "vt": "bin"
           }
       ],
       "repeat": "",
       "crontab": "",
       "once": false,
       "onceDelay": 0.1,
       "topic": "",
       "x": 150,
       "y": 80,
       "wires": [
           [
               "b822a5c6e6e5a711"
           ]
       ]
   },
   {
       "id": "f8c660323b580df5",
       "type": "buffer-maker",
       "z": "385f4b8d434f6005",
       "name": "FUNC und DATA",
       "specification": "spec",
       "specificationType": "ui",
       "items": [
           {
               "name": "header",
               "type": "buffer",
               "length": -1,
               "dataType": "msg",
               "data": "payload"
           },
           {
               "name": "FUNC",
               "type": "byte",
               "length": 1,
               "dataType": "msg",
               "data": "FUNC"
           },
           {
               "name": "DATA",
               "type": "buffer",
               "length": -1,
               "dataType": "msg",
               "data": "DATA"
           }
       ],
       "swap1": "",
       "swap2": "",
       "swap3": "",
       "swap1Type": "swap",
       "swap2Type": "swap",
       "swap3Type": "swap",
       "msgProperty": "payload",
       "msgPropertyType": "str",
       "x": 570,
       "y": 80,
       "wires": [
           [
               "88b327dbfb39ca80"
           ]
       ]
   },
   {
       "id": "d029a20fb5676950",
       "type": "debug",
       "z": "385f4b8d434f6005",
       "name": "Final Packet",
       "active": true,
       "tosidebar": true,
       "console": false,
       "tostatus": false,
       "complete": "payload",
       "targetType": "msg",
       "statusVal": "",
       "statusType": "auto",
       "x": 1210,
       "y": 120,
       "wires": []
   },
   {
       "id": "88b327dbfb39ca80",
       "type": "function",
       "z": "385f4b8d434f6005",
       "name": "Checksum",
       "func": "msg.checksum = 0;\nfor (var x of msg.payload.values()) {\n    msg.checksum += x;\n}\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "initialize": "",
       "finalize": "",
       "libs": [],
       "x": 770,
       "y": 80,
       "wires": [
           [
               "19c7a157927761dd"
           ]
       ]
   },
   {
       "id": "19c7a157927761dd",
       "type": "buffer-maker",
       "z": "385f4b8d434f6005",
       "name": "Header und Checksum",
       "specification": "spec",
       "specificationType": "ui",
       "items": [
           {
               "name": "header",
               "type": "buffer",
               "length": 2,
               "dataType": "bin",
               "data": "[253,253]"
           },
           {
               "name": "payload",
               "type": "buffer",
               "length": -1,
               "dataType": "msg",
               "data": "payload"
           },
           {
               "name": "item3",
               "type": "uint16le",
               "length": 1,
               "dataType": "msg",
               "data": "checksum"
           }
       ],
       "swap1": "",
       "swap2": "",
       "swap3": "",
       "swap1Type": "swap",
       "swap2Type": "swap",
       "swap3Type": "swap",
       "msgProperty": "payload",
       "msgPropertyType": "str",
       "x": 980,
       "y": 80,
       "wires": [
           [
               "d029a20fb5676950",
               "69e5f16a7ba0a2d7"
           ]
       ]
   },
   {
       "id": "65b737e55abf4055",
       "type": "udp in",
       "z": "385f4b8d434f6005",
       "d": true,
       "name": "",
       "iface": "",
       "port": "4000",
       "ipv": "udp4",
       "multicast": "false",
       "group": "",
       "datatype": "buffer",
       "x": 160,
       "y": 160,
       "wires": [
           [
               "78d6d6a15e93d806"
           ]
       ]
   },
   {
       "id": "69e5f16a7ba0a2d7",
       "type": "udp out",
       "z": "385f4b8d434f6005",
       "d": true,
       "name": "",
       "addr": "192.168.4.1",
       "iface": "",
       "port": "4000",
       "ipv": "udp4",
       "outport": "4000",
       "base64": false,
       "multicast": "false",
       "x": 1240,
       "y": 80,
       "wires": []
   },
   {
       "id": "8c24bc356424c638",
       "type": "inject",
       "z": "385f4b8d434f6005",
       "name": "incoming packet",
       "props": [
           {
               "p": "payload"
           }
       ],
       "repeat": "",
       "crontab": "",
       "once": false,
       "onceDelay": 0.1,
       "topic": "",
       "payload": "[253,253,2,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,49,49,49,49,1,1,2,222,0]",
       "payloadType": "bin",
       "x": 140,
       "y": 200,
       "wires": [
           [
               "78d6d6a15e93d806"
           ]
       ]
   },
   {
       "id": "78d6d6a15e93d806",
       "type": "function",
       "z": "385f4b8d434f6005",
       "name": "parse Buffer",
       "func": "let buffer=msg.payload;\nlet size_ID = buffer.slice(3).readInt8();\nlet size_PW = buffer.slice(4 + size_ID).readInt8();\nlet object={\n    \"TYPE\": buffer.slice(2, 3).readInt8(),\n    \"SIZE_ID\": size_ID,\n    \"ID\": buffer.slice(4,size_ID + 4).toString(),\n    \"SIZE_PW\": size_PW,\n    \"PWD\": buffer.slice(4 + size_ID + 1, 4 + size_ID + 1 + size_PW).toString(),\n    \"FUNC\": buffer.slice(4 + size_ID + 1 + size_PW).readInt8(),\n    \"DATA\": buffer.slice(4 + size_ID + 1 + size_PW+ 1,-2),\n    \"Checksum\" : buffer.slice(-2)\n}\n\nmsg.payload = object;\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "initialize": "",
       "finalize": "",
       "libs": [],
       "x": 350,
       "y": 200,
       "wires": [
           [
               "af96eaba3270a79f"
           ]
       ]
   },
   {
       "id": "af96eaba3270a79f",
       "type": "debug",
       "z": "385f4b8d434f6005",
       "name": "parsed Buffer",
       "active": true,
       "tosidebar": true,
       "console": false,
       "tostatus": false,
       "complete": "payload",
       "targetType": "msg",
       "statusVal": "",
       "statusType": "auto",
       "x": 540,
       "y": 200,
       "wires": []
   }
]