I have been struggling with this UI table for a while
I have a sensor running. I would like to create a snapshot of the data (time and temperature) when a certain event is happening so I can store it in my UI table for later use.
I can press the button once and receive the data of one moment. But I need to add a different row per click instead of overwriting the previous data collection.
Could someone help me with adding new rows with new data everytime I hit a button?
[{"id":"547d6e73f83a51b5","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"64b4d7283483e209","type":"function","z":"547d6e73f83a51b5","name":"update or add to table","func":"\nvar temperature = msg.temperature;\nvar id = Number(msg.id);\nvar time = msg.time\n\nmsg.payload={\n command:\"updateOrAddData\",\n arguments: [\n [\n {\n \"id\": id,\n \"temperature\": temperature,\n \"time\": msg.time \n }\n ]\n ],\n returnPromise: true\n}\n\n\n\n\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1380,"y":1160,"wires":[["5ca6d5339f79fea9"]]},{"id":"5ca6d5339f79fea9","type":"ui_table","z":"547d6e73f83a51b5","group":"519d07fc52813146","name":"","order":1,"width":"0","height":"0","columns":[{"field":"id","title":"Fraction","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"temperature","title":"Temperature ℃","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"time","title":"Time","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":1,"cts":true,"x":1590,"y":1160,"wires":[["4d58a5ca6b17999c"]]},{"id":"fca94b0ed091a778","type":"change","z":"547d6e73f83a51b5","name":"Change node","rules":[{"t":"set","p":"temperature","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"id","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":1160,"wires":[["61758af6e2ec595d"]]},{"id":"342761b3b6e758d3","type":"change","z":"547d6e73f83a51b5","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1920,"y":1160,"wires":[[]]},{"id":"4d58a5ca6b17999c","type":"switch","z":"547d6e73f83a51b5","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"id","vt":"str"},{"t":"eq","v":"temperature","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1730,"y":1160,"wires":[["342761b3b6e758d3"],["342761b3b6e758d3"]]},{"id":"2a35ee1ff4528f5d","type":"sensor-ds18b20","z":"547d6e73f83a51b5","name":"Temperature sensor","topic":"","sensorid":"28-00000003f09c","timer":"1","repeat":false,"x":360,"y":1160,"wires":[["fca94b0ed091a778"]]},{"id":"d724c08838cc9435","type":"inject","z":"547d6e73f83a51b5","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":140,"y":1140,"wires":[["2a35ee1ff4528f5d"]]},{"id":"aba6362d429af909","type":"debug","z":"547d6e73f83a51b5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2190,"y":600,"wires":[]},{"id":"26298d72780fc2c2","type":"string","z":"547d6e73f83a51b5","name":"","methods":[{"name":"toInteger","params":[]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":2110,"y":1160,"wires":[[]]},{"id":"61758af6e2ec595d","type":"moment","z":"547d6e73f83a51b5","name":"Add time and date","topic":"","input":"","inputType":"date","inTz":"ETC/GMT","adjAmount":"2","adjType":"hours","adjDir":"add","format":"","locale":"nl_NL","output":"time","outputType":"msg","outTz":"Europe/Amsterdam","x":770,"y":1160,"wires":[["d2f7a7bdef458d4f"]]},{"id":"d2f7a7bdef458d4f","type":"function","z":"547d6e73f83a51b5","name":"add time and temperature to payload object","func":"msg.payload = {\n \"temperature\": Number(msg.payload),\n \"time\": msg.time \n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1070,"y":1160,"wires":[["64b4d7283483e209"]]},{"id":"e9a8b2eaf9ca9133","type":"ui_button","z":"547d6e73f83a51b5","name":"Data snapshot","group":"519d07fc52813146","order":29,"width":0,"height":0,"passthru":false,"label":"Data snapshot","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":190,"y":1240,"wires":[["2a35ee1ff4528f5d"]]},{"id":"519d07fc52813146","type":"ui_group","name":"Reageerbuis","tab":"8b21002.03afe","order":1,"disp":true,"width":"12","collapse":false,"className":""},{"id":"8b21002.03afe","type":"ui_tab","name":"Autosampler","icon":"dashboard","disabled":false,"hidden":false}]