Dear all.
Before I begin my question, first a big thanks to @Christian-Me who helped me intensively with making this flow.
Introduction to the question.
I run experiments (I am a chemist and teacher). In these experiments one needs to monitor:
- Total duration of the experiment,
- Temperature during the experiment
- power setting during the experiment
- Change of events
The total duration will be kept track of by using the stopwatch in the flow
Temperature sensor is a DS18B20 sensor
Power is regulated by PWM and SSR
The change of events is the main topic of this forum thread.
The one thing that does not do what I want it to do is the addition of the time (coming from the stopwatch) each time the "data snapshot" button is pressed.
The problem for me lies in that the stopwatch keeps sending messages and will therefore update the table every second.
My question!
Could someone assist in a solution to this problem so that every time I press data snapshot, all cells are filled?
[{"id":"a7ceb75ea06b966e","type":"sensor-ds18b20","z":"900b27bde2f7f3ae","name":"Sensor 1","topic":"","sensorid":"28-00000003f09c","timer":"2","repeat":false,"x":620,"y":1120,"wires":[["23c413ac74544660"]]},{"id":"8dc53bc322cd8e03","type":"sensor-ds18b20","z":"900b27bde2f7f3ae","name":"Sensor 1","topic":"","sensorid":"28-00000003f09c","timer":"2","repeat":false,"x":600,"y":1380,"wires":[["fd83c655392b441c"]]},{"id":"23c413ac74544660","type":"switch","z":"900b27bde2f7f3ae","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"limit","vt":"global"},{"t":"eq","v":"limit","vt":"global"},{"t":"gt","v":"limit","vt":"global"}],"checkall":"true","repair":false,"outputs":3,"x":810,"y":1060,"wires":[[],[],["38f1cc8a2f77a80a"]]},{"id":"e840ca44b9f8e341","type":"change","z":"900b27bde2f7f3ae","name":"","rules":[{"t":"set","p":"limit","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":600,"wires":[[]]},{"id":"38f1cc8a2f77a80a","type":"change","z":"900b27bde2f7f3ae","name":"power to 0","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":1060,"wires":[["8306dfd612226c07","04d2dfaf92a34cef","ebfc4f9cd6092a28","6de5b9713b17f209"]]},{"id":"52a5ce6e17a83f74","type":"change","z":"900b27bde2f7f3ae","name":"blocked sends \"false\" message","rules":[{"t":"set","p":"blocked","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1770,"y":1100,"wires":[["ef1f8d9632fdaf92"]]},{"id":"8306dfd612226c07","type":"change","z":"900b27bde2f7f3ae","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":1060,"wires":[["911a72de169a526b","f79af8d70ab84648"]]},{"id":"fe7ff9d19b9d39c1","type":"change","z":"900b27bde2f7f3ae","name":"unblocked sends \"true\" message","rules":[{"t":"set","p":"blocked","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1780,"y":1020,"wires":[[]]},{"id":"55dfd592d78dc97e","type":"ui_led","z":"900b27bde2f7f3ae","order":7,"group":"d34a34f75373b4ad","width":1,"height":1,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#ff0000","value":"false","valueType":"bool"},{"color":"#ff0000","value":"0","valueType":"str"},{"color":"#008000","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":1630,"y":1060,"wires":[]},{"id":"b0600c7a97720c1a","type":"ui_text","z":"900b27bde2f7f3ae","group":"d34a34f75373b4ad","order":1,"width":6,"height":1,"name":"global shut off temperature value","label":"global shut off temperature value","format":"{{msg.payload}}","layout":"row-left","className":"","x":360,"y":560,"wires":[]},{"id":"dd6e4febb9424d73","type":"ui_text","z":"900b27bde2f7f3ae","group":"d34a34f75373b4ad","order":6,"width":3,"height":1,"name":"Power","label":"Power","format":"{{msg.payload}}","layout":"row-spread","className":"","x":1770,"y":580,"wires":[]},{"id":"fd66b06304985014","type":"ui_button","z":"900b27bde2f7f3ae","name":"Data snapshot","group":"d34a34f75373b4ad","order":24,"width":0,"height":0,"passthru":false,"label":"Data snapshot","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":320,"y":1380,"wires":[["8dc53bc322cd8e03","309d66d5f207083c"]]},{"id":"e0246ced281bd0e2","type":"inject","z":"900b27bde2f7f3ae","name":"every 1 second","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1780,"y":860,"wires":[["da0f333d4b468fcf"]]},{"id":"da0f333d4b468fcf","type":"switch","z":"900b27bde2f7f3ae","name":"flow.clock_state == \"run\" ?","property":"clock_state","propertyType":"flow","rules":[{"t":"eq","v":"run","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":2040,"y":860,"wires":[["b689f487e9a49b33"]]},{"id":"5fd4dff1a1456918","type":"change","z":"900b27bde2f7f3ae","name":"set clock_value to 0","rules":[{"t":"set","p":"clock_value","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"clock_state","pt":"flow","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2010,"y":940,"wires":[["7932ca360e4ffac8"]]},{"id":"b689f487e9a49b33","type":"function","z":"900b27bde2f7f3ae","name":"decrement flow.clock_value","func":"let clock_value = flow.get(\"clock_value\") || 0;\n\nclock_value++; \n\nif (clock_value < 0) clock_value = 0;\n\nflow.set(\"clock_value\", clock_value);\n\nmsg.payload = clock_value;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2340,"y":860,"wires":[["7932ca360e4ffac8"]]},{"id":"7932ca360e4ffac8","type":"function","z":"900b27bde2f7f3ae","name":"seconds to minute:seconds","func":"let secsDecimal = msg.payload;\n\nlet mins = Math.floor(secsDecimal/60);\nlet secs = secsDecimal % 60;\n\nmsg.payload = (mins + (secs / 100.0)).toFixed(2)\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2660,"y":940,"wires":[["4104ece8085cefa3","a176351c49b17c8a"]]},{"id":"fab99f47bc50b057","type":"function","z":"900b27bde2f7f3ae","name":"toggle flow.clock_state","func":"let clock_state = flow.get(\"clock_state\") || \"stop\";\n\nclock_state = clock_state === \"stop\" ? \"run\" : \"stop\";\n\nflow.set(\"clock_state\", clock_state );\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2360,"y":900,"wires":[["7932ca360e4ffac8"]]},{"id":"ddf6a33775a62eee","type":"switch","z":"900b27bde2f7f3ae","name":"Timer function starting point","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1740,"y":920,"wires":[["2365ea4d963af544"],["5fd4dff1a1456918"]]},{"id":"2365ea4d963af544","type":"change","z":"900b27bde2f7f3ae","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"run","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2000,"y":900,"wires":[["fab99f47bc50b057"]]},{"id":"4104ece8085cefa3","type":"ui_text","z":"900b27bde2f7f3ae","group":"3e0d8616af34c894","order":16,"width":8,"height":1,"name":"Distillation timer ","label":"Distillation timer ","format":"{{msg.payload}}","layout":"row-spread","className":"","x":2920,"y":940,"wires":[]},{"id":"04d2dfaf92a34cef","type":"ui_gauge","z":"900b27bde2f7f3ae","name":"Current power gauge","group":"d34a34f75373b4ad","order":15,"width":6,"height":6,"gtype":"gage","title":"Current power","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#ff0000","#00ff00","#ff0000"],"seg1":"40","seg2":"60","className":"","x":1380,"y":740,"wires":[]},{"id":"ebfc4f9cd6092a28","type":"rpi-gpio out","z":"900b27bde2f7f3ae","name":"","pin":"22","set":"","level":"0","freq":"1","out":"pwm","bcm":true,"x":1340,"y":780,"wires":[]},{"id":"a242cfe671501a9f","type":"switch","z":"900b27bde2f7f3ae","name":"","property":"blocked","propertyType":"global","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1130,"y":760,"wires":[["04d2dfaf92a34cef","ebfc4f9cd6092a28"]]},{"id":"d03a996e434c386d","type":"change","z":"900b27bde2f7f3ae","name":"Reset powervalue at power On and Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1930,"y":1060,"wires":[["881c7a15dec9b590"]]},{"id":"6de5b9713b17f209","type":"ui_text_input","z":"900b27bde2f7f3ae","name":"Power Setting","label":"Power Setting","tooltip":"","group":"d34a34f75373b4ad","order":13,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"payload","sendOnBlur":true,"className":"","topicType":"msg","x":920,"y":760,"wires":[["a242cfe671501a9f","54ec53ac701cadb6"]]},{"id":"b2a9169d2a64a0ac","type":"ui_text_input","z":"900b27bde2f7f3ae","name":"global shut off temperature value","label":"","tooltip":"","group":"d34a34f75373b4ad","order":2,"width":3,"height":1,"passthru":true,"mode":"text","delay":300,"topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":360,"y":600,"wires":[["e840ca44b9f8e341"]]},{"id":"3b5f5e10d9509ec8","type":"inject","z":"900b27bde2f7f3ae","name":"shut off test (temperature simulation)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"103","payloadType":"num","x":580,"y":1060,"wires":[["23c413ac74544660"]]},{"id":"881c7a15dec9b590","type":"link out","z":"900b27bde2f7f3ae","name":"Send 0 At Power Off","mode":"link","links":["536f8c623c7ac1ba"],"x":2155,"y":1060,"wires":[]},{"id":"536f8c623c7ac1ba","type":"link in","z":"900b27bde2f7f3ae","name":"Receive 0 At Power Off","links":["c70b9649e1d671e4","881c7a15dec9b590"],"x":755,"y":760,"wires":[["6de5b9713b17f209"]]},{"id":"ef1f8d9632fdaf92","type":"link out","z":"900b27bde2f7f3ae","name":"Send geblokkeerd geeft false bericht","mode":"link","links":["a5fd7b22da3d78dc"],"x":1955,"y":1100,"wires":[]},{"id":"a5fd7b22da3d78dc","type":"link in","z":"900b27bde2f7f3ae","name":"Receive geblokkeerd geeft false bericht","links":["ef1f8d9632fdaf92","986765faa98821ab","9a73bda45141f2f8"],"x":925,"y":1140,"wires":[["38f1cc8a2f77a80a"]]},{"id":"be32c5c562e86daf","type":"function","z":"900b27bde2f7f3ae","name":"add new snapshot (snapshot trigger)","func":"// get last counter or initialize to 0 from flow because we will need the last counter for your other measuremnts\nvar counter = flow.get('counter') || 0;\ncounter++; // increment counter by one;\n\n// add id and timestamp to the payload and keep existing properties\nmsg.payload.id = counter;\nmsg.payload.time = Date.now();\n\n\nflow.set('counter',counter); // store counter flow context;\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2810,"y":1220,"wires":[[]]},{"id":"230caf65f2dbbc3f","type":"function","z":"900b27bde2f7f3ae","name":"update or add to table","func":"msg.payload={\n command:\"updateOrAddData\",\n arguments: [\n [\n msg.payload // simply pass all proerties of the payload\n ]\n ],\n returnPromise: true\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3500,"y":1380,"wires":[["4a23fdddc5ae1613"]]},{"id":"4a23fdddc5ae1613","type":"ui_table","z":"900b27bde2f7f3ae","group":"d34a34f75373b4ad","name":"","order":12,"width":26,"height":8,"columns":[{"field":"id","title":"Fraction","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"time","title":"Time","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"temperature","title":"Temperature","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"setPower","title":"Power","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":1,"cts":true,"x":3710,"y":1380,"wires":[[]]},{"id":"1f1b5b0ae002f698","type":"change","z":"900b27bde2f7f3ae","name":"Set msg.topic to setPower","rules":[{"t":"set","p":"topic","pt":"msg","to":"setPower","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2430,"y":1340,"wires":[["040a6dc3655b31d5"]]},{"id":"a176351c49b17c8a","type":"change","z":"900b27bde2f7f3ae","name":"Set msg.topic to time","rules":[{"t":"set","p":"topic","pt":"msg","to":"time","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2300,"y":1300,"wires":[["7b2a1f299c1749a6"]]},{"id":"48068729b6de3c29","type":"inject","z":"900b27bde2f7f3ae","name":"ui_control","props":[{"p":"ui_control","v":"{\"tabulator\":{\"columns\":[{\"field\":\"time\",\"formatter\":\"datetime\",\"formatterParams\":{\"inputFormat\":\"x\",\"outputFormat\":\"HH:mm.ss.S\"}},{\"field\":\"temperature\",\"formatterParams\":{\"precision\":2,\"unit\":\"°C\"},\"formatter\":\"function (cell, formatterParams, onRendered) { let result = Number(cell.getValue()); if (Number.isNaN(result)) return cell.getValue(); result = result.toFixed(formatterParams.precision); result += (formatterParams.unit) ? formatterParams.unit : ''; return result; }\",\"topCalc\":\"avg\"},{\"formatterParams\":{\"field\":\"power\",\"formatter\":\"value\",\"topCalc\":\"avg\"}}]}}","vt":"json"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.5","topic":"","x":3540,"y":1440,"wires":[["4a23fdddc5ae1613"]]},{"id":"25fc5c5a72f7cecb","type":"change","z":"900b27bde2f7f3ae","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"id\":0,\"power\":0}]","tot":"json"},{"t":"set","p":"counter","pt":"flow","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":3520,"y":1320,"wires":[["4a23fdddc5ae1613"]]},{"id":"36d18a2c01386c20","type":"ui_button","z":"900b27bde2f7f3ae","name":"restart","group":"d34a34f75373b4ad","order":4,"width":1,"height":1,"passthru":true,"label":"","tooltip":"","color":"","bgcolor":"","className":"","icon":"restore","payload":"restart","payloadType":"str","topic":"control","topicType":"str","x":3330,"y":1340,"wires":[["25fc5c5a72f7cecb"]]},{"id":"f268fb5a45c6be01","type":"ui_ui_control","z":"900b27bde2f7f3ae","name":"","events":"change","x":3320,"y":1300,"wires":[["25fc5c5a72f7cecb"]]},{"id":"f35b20d65e8c0b53","type":"change","z":"900b27bde2f7f3ae","name":"add last counter","rules":[{"t":"set","p":"payload.id","pt":"msg","to":"counter","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":2900,"y":1380,"wires":[["818857a10a9680fd"]]},{"id":"5b9ce9155c66e437","type":"function","z":"900b27bde2f7f3ae","name":"Format For Table","func":"var tableRow = {\n command: \"updateOrAddData\",\n arguments: [\n [\n {\n priority: msg.payload.priority, \n loadName: msg.payload.name,\n type: msg.payload.type,\n ratedPower: msg.payload.ratedPower,\n powerUsage: msg.payload.powerUsage,\n state: msg.payload.state\n } \n ]\n ],\n returnPromise: true\n};\n\n// Replace the status strings with icons to go in the table\nif (tableRow.arguments[0][0].state == \"active\")\n tableRow.arguments[0][0].state = '<i class=\"material-icons icon-2x\" style=\"color: navy;\">check_circle</i>';\nelse if (tableRow.arguments[0][0].state == \"inactive\")\n tableRow.arguments[0][0].state = '<i class=\"material-icons icon-2x\" style=\"color: gray;\">check_circle_outline</i>';\nelse if (tableRow.arguments[0][0].state == \"disabled\")\n tableRow.arguments[0][0].state = '<i class=\"material-icons icon-2x\" style=\"color: red;\">dnd_forwardslash</i>';\nelse\n tableRow.arguments[0][0].state = '<i class=\"material-icons icon-2x\" style=\"color: gray;\">radio_button_unchecked</i>';\n \nmsg.payload = tableRow;\nnode.warn(tableRow.arguments[0][0].priority);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3130,"y":1240,"wires":[[]]},{"id":"040a6dc3655b31d5","type":"join","z":"900b27bde2f7f3ae","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":2710,"y":1380,"wires":[["f35b20d65e8c0b53"]]},{"id":"911a72de169a526b","type":"ui_button","z":"900b27bde2f7f3ae","name":"Off","group":"d34a34f75373b4ad","order":22,"width":0,"height":0,"passthru":false,"label":"Off","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"false","payloadType":"bool","topic":"topic","topicType":"msg","x":1470,"y":1100,"wires":[["55dfd592d78dc97e","d03a996e434c386d","52a5ce6e17a83f74","ddf6a33775a62eee"]]},{"id":"f79af8d70ab84648","type":"ui_button","z":"900b27bde2f7f3ae","name":"ON","group":"d34a34f75373b4ad","order":23,"width":0,"height":0,"passthru":false,"label":"ON","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","x":1470,"y":1020,"wires":[["55dfd592d78dc97e","ddf6a33775a62eee","fe7ff9d19b9d39c1","d03a996e434c386d"]]},{"id":"fd83c655392b441c","type":"change","z":"900b27bde2f7f3ae","name":"set msg.topic to temperature for table","rules":[{"t":"set","p":"topic","pt":"msg","to":"temperature","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":1380,"wires":[["040a6dc3655b31d5"]]},{"id":"89df341ee491b9ad","type":"inject","z":"900b27bde2f7f3ae","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":1470,"y":1060,"wires":[["55dfd592d78dc97e","ddf6a33775a62eee"]]},{"id":"c439b40aed5eb226","type":"inject","z":"900b27bde2f7f3ae","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":870,"y":980,"wires":[["38f1cc8a2f77a80a"]]},{"id":"b74927892128db58","type":"inject","z":"900b27bde2f7f3ae","name":"ui_control","props":[{"p":"ui_control","v":"{\"tabulator\":{\"columns\":[{\"field\":\"time\",\"formatter\":\"datetime\",\"formatterParams\":{\"inputFormat\":\"x\",\"outputFormat\":\"HH:mm.ss\",\"invalidPlaceholder\":\"(invalid date)\"}},{\"field\":\"temperature\",\"formatterParams\":{\"precision\":2,\"unit\":\"°C\"},\"formatter\":\"function (cell, formatterParams, onRendered) { let result = Number(cell.getValue()); if (Number.isNaN(result)) return cell.getValue(); result = result.toFixed(formatterParams.precision); result += (formatterParams.unit) ? formatterParams.unit : ''; return result; }\"}]}}","vt":"json"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":3320,"y":1060,"wires":[[]]},{"id":"791356f19c40d6d1","type":"inject","z":"900b27bde2f7f3ae","name":"ui_control","props":[{"p":"ui_control","v":"{\"tabulator\":{\"columns\":[{\"field\":\"time\",\"formatter\":\"datetime\",\"formatterParams\":{\"inputFormat\":\"x\",\"outputFormat\":\"HH:mm.ss.S\",\"invalidPlaceholder\":\"take snapshot\"}},{\"field\":\"temperature\",\"formatterParams\":{\"precision\":2,\"unit\":\"°C\"},\"formatter\":\"function (cell, formatterParams, onRendered) { let result = Number(cell.getValue()); if (Number.isNaN(result)) return cell.getValue(); result = result.toFixed(formatterParams.precision); result += (formatterParams.unit) ? formatterParams.unit : ''; return result; }\",\"topCalc\":\"avg\"},{\"formatterParams\":{\"target\":\"_blank\",\"min\":0,\"max\":100,\"color\":[\"blue\",\"green\",\"red\"],\"legend\":\"function (value) {return ' '+Number(value).toFixed(1)+' %';}\",\"legendColor\":\"#FFFFFF\",\"legendAlign\":\"left\"},\"field\":\"power\",\"formatter\":\"progress\",\"topCalc\":\"avg\"}]}}","vt":"json"},{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.5","topic":"","payload":"","payloadType":"str","x":3300,"y":1020,"wires":[[]]},{"id":"4ece490235a0da41","type":"inject","z":"900b27bde2f7f3ae","name":"ui_control","props":[{"p":"ui_control","v":"{\"tabulator\":{\"columns\":[{\"field\":\"time\",\"formatter\":\"datetime\",\"formatterParams\":{\"inputFormat\":\"x\",\"outputFormat\":\"HH:mm.ss.S\",\"invalidPlaceholder\":\"take snapshot\"}},{\"field\":\"temperature\",\"formatterParams\":{\"precision\":2,\"unit\":\"°C\"},\"formatter\":\"function (cell, formatterParams, onRendered) { let result = Number(cell.getValue()); if (Number.isNaN(result)) return cell.getValue(); result = result.toFixed(formatterParams.precision); result += (formatterParams.unit) ? formatterParams.unit : ''; return result; }\"}]}}","vt":"json"},{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.5","topic":"","payload":"","payloadType":"str","x":3280,"y":980,"wires":[[]]},{"id":"54ec53ac701cadb6","type":"link out","z":"900b27bde2f7f3ae","name":"Send power setting","mode":"link","links":["9c3a53f908f530b3"],"x":1045,"y":800,"wires":[]},{"id":"9c3a53f908f530b3","type":"link in","z":"900b27bde2f7f3ae","name":"Receive power setting","links":["54ec53ac701cadb6"],"x":2115,"y":1340,"wires":[["1f1b5b0ae002f698"]]},{"id":"309d66d5f207083c","type":"link out","z":"900b27bde2f7f3ae","name":"Send data snapshot trigger","mode":"link","links":["76e7f23d6ebff6d9","b7c7ca777e512c2a","b7526058c85463f0","7294beba04a96d6f"],"x":505,"y":1420,"wires":[]},{"id":"818857a10a9680fd","type":"function","z":"900b27bde2f7f3ae","name":"add new snapshot (snapshot trigger)","func":"// get last counter or initialize to 0 from flow because we will need the last counter for your other measuremnts\nvar counter = flow.get('counter') || 0;\ncounter++; // increment counter by one;\n\n// add id and timestamp to the payload and keep existing properties\nmsg.payload.id = counter;\n//msg.payload.time = Date.now();\n\n\nflow.set('counter',counter); // store counter flow context;\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3190,"y":1380,"wires":[["230caf65f2dbbc3f"]]},{"id":"b7c7ca777e512c2a","type":"link in","z":"900b27bde2f7f3ae","name":"","links":["309d66d5f207083c"],"x":2115,"y":1300,"wires":[["a176351c49b17c8a"]]},{"id":"7b2a1f299c1749a6","type":"join","z":"900b27bde2f7f3ae","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":2490,"y":1300,"wires":[["040a6dc3655b31d5"]]},{"id":"1dac3346dee676e1","type":"inject","z":"900b27bde2f7f3ae","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":2020,"y":1220,"wires":[[]]},{"id":"d34a34f75373b4ad","type":"ui_group","name":"Table tester","tab":"0264230475e6a091","order":2,"disp":true,"width":"26","collapse":false,"className":""},{"id":"3e0d8616af34c894","type":"ui_group","name":"Calculations","tab":"0264230475e6a091","order":1,"disp":true,"width":9,"collapse":false,"className":""},{"id":"0264230475e6a091","type":"ui_tab","name":"Table tester","icon":"dashboard","disabled":false,"hidden":false}]
Additional info:
The rules of the flow are as followed:
The timer must start when "on" is pressed.
The timer must clear when "off" is pressed.
The power setting must turn to 0 when "off" is pressed (safety)
The power must be set to 0 when "on" is pressed (safety)
change power value = update table (including the current live readings from temperature and time)
pressing data snapshot = update the table (including the current live readings from temperature and time and power setting)