Send multiple TCP commands after release and how to check if it's done and successfull

I have working TCP communication with heating main unit.
This flow will send a TCP commands (sep by step) to main unit to make a temperature change :

[{"id":"d261b90f0cf38dc3","type":"tcp request","z":"59fb2f9263e14661","server":"192.168.0.178","port":"45000","out":"time","ret":"buffer","splitc":"1000","name":"","x":1590,"y":540,"wires":[["dff0583483ed06e5"]]},{"id":"35a7be32ffab4fb3","type":"ui_button","z":"59fb2f9263e14661","name":"","group":"8c11279992e11f1f","order":4,"width":0,"height":0,"passthru":false,"label":"1 den doma","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","x":250,"y":540,"wires":[["9ff70527afceb5cd"]]},{"id":"1f58210bb6040820","type":"split","z":"59fb2f9263e14661","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":570,"y":540,"wires":[["421618f7ceb744d1"]]},{"id":"421618f7ceb744d1","type":"function","z":"59fb2f9263e14661","name":"to buffer","func":"msg.payload = Buffer.from(msg.payload)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":720,"y":540,"wires":[["28a3ca2a60938c03"]]},{"id":"28a3ca2a60938c03","type":"semaphore-take","z":"59fb2f9263e14661","config":"6dab6620e4aba0d8","name":"","x":880,"y":540,"wires":[["3a9b2f7c66cf547b"]]},{"id":"1811e824980f9ed4","type":"semaphore-leave","z":"59fb2f9263e14661","config":"6dab6620e4aba0d8","name":"","x":2010,"y":540,"wires":[["fb15376f26bb15fa"]]},{"id":"3a9b2f7c66cf547b","type":"function","z":"59fb2f9263e14661","name":"ADD config","func":"//Main unit CFG\n//DLE\nmsg.payload.writeUInt8(0x10,0)\n//SOH\nmsg.payload.writeUInt8(0x01,1)\n//adresa 255,255\n//BUSH\nmsg.payload.writeUInt8(0xFF,2)\n//BUSL\nmsg.payload.writeUInt8(0xFF,3)\n//END fix 255\nmsg.payload.writeUInt8(0xFF,14)\n//DC příkaz 4C zapiš 5bajtů\nmsg.payload.writeUInt8(0x4C,6)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1050,"y":540,"wires":[["05d37ade696f5eb9"]]},{"id":"958c20251d6ce42f","type":"function","z":"59fb2f9263e14661","name":"adds xor","func":"let ADDS = 0;\nlet XORS = 0;\nfor (let index = 0; index < ((msg.payload.length)-3); index++) {\n    const value = msg.payload.readUInt8(index);\n    ADDS += value;\n    XORS ^= value;\n}\nADDS = (ADDS ^ 0xAA) & 0xFF;\nXORS = (XORS ^ 0xAA) & 0xFF;\nmsg.payload.writeUInt8(ADDS,12)\nmsg.payload.writeUInt8(XORS,13)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1400,"y":540,"wires":[["d261b90f0cf38dc3","e488b75a5e149ca8"]]},{"id":"fb15376f26bb15fa","type":"debug","z":"59fb2f9263e14661","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2190,"y":540,"wires":[]},{"id":"dff0583483ed06e5","type":"function","z":"59fb2f9263e14661","name":"result check","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1790,"y":540,"wires":[["1811e824980f9ed4"]]},{"id":"9ff70527afceb5cd","type":"function","z":"59fb2f9263e14661","name":"Request","func":"msg.payload = [\n[\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x11\",\"0x83\",\"0x00\",\"0x11\",\"0x00\",\"0x00\",\"0x01\",\"0x00\",\"0x00\",\"0x00\",\"0x00\"],\n[\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x11\",\"0x93\",\"0x00\",\"0x11\",\"0x00\",\"0x00\",\"0x01\",\"0x00\",\"0x00\",\"0x00\",\"0x00\"],\n[\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x11\",\"0xA3\",\"0x00\",\"0x11\",\"0x00\",\"0x00\",\"0x01\",\"0x00\",\"0x00\",\"0x00\",\"0x00\"],\n[\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x11\",\"0xB3\",\"0x00\",\"0x11\",\"0x00\",\"0x00\",\"0x01\",\"0x00\",\"0x00\",\"0x00\",\"0x00\"],\n[\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x11\",\"0xC3\",\"0x00\",\"0x11\",\"0x00\",\"0x00\",\"0x01\",\"0x00\",\"0x00\",\"0x00\",\"0x00\"],\n[\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x11\",\"0xD3\",\"0x00\",\"0x0F\",\"0x00\",\"0x00\",\"0x01\",\"0x00\",\"0x00\",\"0x00\",\"0x00\"],\n[\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x11\",\"0xE3\",\"0x00\",\"0x0F\",\"0x00\",\"0x00\",\"0x01\",\"0x00\",\"0x00\",\"0x00\",\"0x00\"],\n]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":540,"wires":[["1f58210bb6040820"]]},{"id":"05d37ade696f5eb9","type":"function","z":"59fb2f9263e14661","name":"Calculate SartTIME","func":"//TOY čas roku - = (mesic_zacatek * 4096) + \n//(den_zacatek * 128) + (hodina_zacatek * 4) + (minuta_zacatek / 15)\n//- vyjde-li po zpětném převodu čas dne>23.45-platí jako 24.00\n//*********************************************************************\n//Read actual date and time\nvar Start_Time=new Date();\nvar Stop_Time=Start_Time;\n//posunuti zacatku pokud definovano\nStart_Time.setDate(Start_Time.getDate()+msg.payload.readUInt8(8));\nStart_Time.setMinutes(Start_Time.getMinutes()+msg.payload.readUInt8(9));\n//součet dle etathermu\nvar F_Start_Time=((Start_Time.getMonth()+1)*4096)+(Start_Time.getDate()*128)+(Start_Time.getHours()*4)+Math.floor(Start_Time.getMinutes()/15);\n//převod součtu na HEX\nF_Start_Time=F_Start_Time.toString(16);\n//rozdělení HEX a uložení jako číslo na dvě adresy\n//D1-Cas pocatek\nmsg.payload.writeUInt8(parseInt((F_Start_Time.substr(0, 2)),16),8)\n//D2-Cas pocatek\nmsg.payload.writeUInt8(parseInt((F_Start_Time.substr(2, 4)),16),9)\n//**********************************************************************\n//vypocet konce\nStop_Time.setDate(Stop_Time.getDate()+msg.payload.readUInt8(10));\nStop_Time.setMinutes(Stop_Time.getMinutes()+msg.payload.readUInt8(11));\n//součet dle etathermu\nvar F_Stop_Time=((Stop_Time.getMonth()+1)*4096)+(Stop_Time.getDate()*128)+(Stop_Time.getHours()*4)+Math.floor(Stop_Time.getMinutes()/15);\n//převod součtu na HEX\nF_Stop_Time=F_Stop_Time.toString(16);\n//rozdělení HEX a uložení jako číslo na dvě adresy\n//D3-Cas konec\nmsg.payload.writeUInt8(parseInt((F_Stop_Time.substr(0, 2)),16),10)\n//D4-Cas konec\nmsg.payload.writeUInt8(parseInt((F_Stop_Time.substr(2, 4)),16),11)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1230,"y":540,"wires":[["958c20251d6ce42f"]]},{"id":"e488b75a5e149ca8","type":"debug","z":"59fb2f9263e14661","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1590,"y":460,"wires":[]},{"id":"8c11279992e11f1f","type":"ui_group","name":"OPERATIVNÍ ZMĚNY","tab":"befeb13c.bfa17","order":1,"disp":true,"width":8,"collapse":false,"className":""},{"id":"6dab6620e4aba0d8","type":"semaphore-config","name":"input","capacity":"1"},{"id":"befeb13c.bfa17","type":"ui_tab","name":"TOPENÍ ETATHERM","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Problem is, that I want implement confirmation, that I want send this commant to prevent unwanted click on the smartphone and also implement status that operation is running - like LED when semaphore is running. After each command I'm also receiving answer from main unit 0xFF that command was successfull, but I don't know how to implement into flow.
Thank you for help

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.