I'm reading data from a S7 PLC and exporting to a csv file. Every 5 seconds it creates a new row.
I would like the first line were the header (the Tag name could be fine). The problem is that if I click the 'Include column name row', it insert it every time.
How could I fix it?
Thank you!
The code:
[{"id":"ba9c1de4.e4f78","type":"s7 in","z":"a0ee9845.7178d8","endpoint":"2ff9070d.93aa08","mode":"all","variable":"Prueba_1","diff":true,"name":"","x":150,"y":140,"wires":[["fe06df33.f33b5","5cc7c3cd.21a1dc"]]},{"id":"fe06df33.f33b5","type":"debug","z":"a0ee9845.7178d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":440,"y":160,"wires":[]},{"id":"8f87343d.7b9cb8","type":"function","z":"a0ee9845.7178d8","name":"Guardar Diario","func":"var d = new Date();\nvar t = d.getTime();\nvar year = d.getFullYear();\nvar month = d.getMonth()+1; \nif(month.toString().length == 1) {\n month = '0'+month;\n}\nvar day = d.getDate();\nif(day.toString().length == 1) {\n day = '0'+day;\n}\nvar hour = d.getHours();\nmsg.date = t;\nmsg.filename = \"D:/Clientes/Node Red/Pruebas/Logs/\"+year+month+day+\"_Registro.csv\";\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":340,"wires":[["23c62f4a.bd6bf"]]},{"id":"5cc7c3cd.21a1dc","type":"delay","z":"a0ee9845.7178d8","name":"PeriodoArchivacion","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":210,"y":340,"wires":[["72de3e4f.2b8ee"]]},{"id":"72de3e4f.2b8ee","type":"function","z":"a0ee9845.7178d8","name":"AñadirFecha","func":"var date;\ndate = new Date();\ndate = (date.getFullYear() + '-' + ('00' + (date.getMonth()+1)).slice(-2) + '-' + ('00' + date.getDate()).slice(-2) + ' ' + ('00' + date.getHours()).slice(-2) + ':' + ('00' + date.getMinutes()).slice(-2) + ':' + ('00' + date.getSeconds()).slice(-2));\nmsg.payload.Time=date;\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":340,"wires":[["f5e8cbb7.ec5978"]]},{"id":"f5e8cbb7.ec5978","type":"csv","z":"a0ee9845.7178d8","name":"","sep":";","hdrin":true,"hdrout":true,"multi":"mult","ret":"\\r\\n","temp":"Time,Prueba_1,Prueba_2","skip":"2","strings":false,"x":630,"y":340,"wires":[["8f87343d.7b9cb8"]]},{"id":"23c62f4a.bd6bf","type":"file","z":"a0ee9845.7178d8","name":"store S7 data to csv file","filename":"","appendNewline":false,"createDir":false,"overwriteFile":"false","x":1050,"y":340,"wires":[[]]},{"id":"2ff9070d.93aa08","type":"s7 endpoint","z":"","transport":"iso-on-tcp","address":"192.168.10.11","port":"102","rack":"0","slot":"1","localtsaphi":"01","localtsaplo":"00","remotetsaphi":"01","remotetsaplo":"00","connmode":"rack-slot","adapterauto":true,"adapterport":"","busaddr":"2","adapteraddr":"0","cycletime":"1000","timeout":"1500","verbose":"default","name":"","vartable":[{"addr":"DB1,REAL0","name":"Prueba_1"},{"addr":"DB1,REAL4","name":"Prueba_2"}]}]