I want to have the 2 values (PH, temp) extracted from mqtt in a CSV file
These values will be extracted from mqtt at the same time cause of the arduino code linked to this.
When these 2 values get published to the CSV file i want the current time and date exported with them.
My code:
[{"id":"ca5b1816.517648","type":"mqtt in","z":"bde2953.9de2c68","name":"PH waarde","topic":"vijver/ph","qos":"2","datatype":"json","broker":"93299d75.6190a","x":100,"y":620,"wires":[["31c9f087.3438f"]]},{"id":"1200210c.c6833f","type":"mqtt in","z":"bde2953.9de2c68","name":"Temp waarde","topic":"vijver/temp","qos":"2","datatype":"json","broker":"93299d75.6190a","x":110,"y":680,"wires":[["7b8e0037.f117a"]]},{"id":"15ba4b3a.fa8815","type":"file","z":"bde2953.9de2c68","name":"","filename":"/share/test.csv","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":960,"y":640,"wires":[[]]},{"id":"ce878c18.15589","type":"join","z":"bde2953.9de2c68","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":450,"y":640,"wires":[["b52021a0.03338"]]},{"id":"31c9f087.3438f","type":"change","z":"bde2953.9de2c68","name":"","rules":[{"t":"set","p":"parts","pt":"msg","to":"2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":620,"wires":[["ce878c18.15589"]]},{"id":"7b8e0037.f117a","type":"change","z":"bde2953.9de2c68","name":"","rules":[{"t":"set","p":"parts","pt":"msg","to":"3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":680,"wires":[["ce878c18.15589"]]},{"id":"b52021a0.03338","type":"function","z":"bde2953.9de2c68","name":"Name of database + timestamp","func":"msg.filename = \"/share/test.txt\";\nvar time = new Date().toString().replace(\" GMT+0200 (Central European Summer Time)\", \"\");\nvar x = msg.payload[0];\nvar y = msg.payload[1];\nmsg.payload = time + ';' + x + ';PH' + ';' + y + \";Graden\" ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":640,"wires":[["15ba4b3a.fa8815","55ae35c3.d6d0ac"]]},{"id":"27d23756.1fe1c8","type":"function","z":"bde2953.9de2c68","name":"Name of database + timestamp","func":"var time = new Date().toString().replace(\"Wed\", \"\").replace(\" GMT+0200 (Central European Summer Time)\", \"\");\nmsg.payload = time;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":490,"y":760,"wires":[["fc6a4f83.2ede8"]]},{"id":"fc6a4f83.2ede8","type":"date-converter","z":"bde2953.9de2c68","name":"","topic":"","input":"payload","inputType":"msg","inTz":"","adjAmount":0,"adjType":"days","adjDir":"add","format":"DD.MM.YYYY HH:mm","locale":"","output":"payload","outputType":"msg","outTz":"","x":760,"y":760,"wires":[["55ae35c3.d6d0ac"],[]]},{"id":"b74db90d.f223a8","type":"inject","z":"bde2953.9de2c68","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":230,"y":760,"wires":[["27d23756.1fe1c8"]]},{"id":"55ae35c3.d6d0ac","type":"debug","z":"bde2953.9de2c68","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":720,"wires":[]},{"id":"93299d75.6190a","type":"mqtt-broker","name":"","broker":"192.168.1.173","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]