hey steve, thanks for your quick response.
Okay, well, my flow is providing a dashboard in which the user can select executables that are lying around in /home/pi.
The Dashboard looks like this:

It's all working fine so far :-)
In the Model Status Section I want an easy timer, which counts up hours:minutes:seconds as soon as the user presses the START THE MODEL Button.
It should also be initialized to zero when the dashboard is openend or set to zero when the STOP THE MODEL Button is pressed.
What I have tried so far is putting this code into the dashboard template node and putting an inject node in front of it to trigger it:
<script src="lib/easytimer/dist/easytimer.min.js"></script>
<script>
var timer = new Timer();
timer.start();
timer.addEventListener('secondsUpdated', function (e) {
$('#basicUsage').html(timer.getTimeValues().toString());
});
</script>
<div id="basicUsage">00:00:00</div>This shows me 00:00:00 in the dashboard and I dont know how i can trigger the start of the timer...
this is the flow:
[{"id":"26c2d2c0.9e320e","type":"exec","z":"832b9098.9bc9c8","command":" cd /home/pi","addpay":false,"append":"","useSpawn":"","timer":"","name":"","x":337,"y":313.5,"wires":[["84a6780d.7affb"],[],[]]},{"id":"84a6780d.7affb","type":"exec","z":"832b9098.9bc9c8","command":"ls *.elf","addpay":true,"append":"","useSpawn":"","timer":"","name":"","x":511,"y":317,"wires":[["485e1966.c0efa"],[],[]]},{"id":"485e1966.c0efa","type":"split","z":"832b9098.9bc9c8","name":"Extract Model Names","splt":".elf","x":560,"y":383,"wires":[["1f814313.19e5b5"]]},{"id":"539764f3.85591c","type":"ui_dropdown","z":"832b9098.9bc9c8","name":"","label":"Select a model","group":"ca473521.47f448","order":3,"width":"0","height":"0","passthru":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":963.7666320800781,"y":452.7000732421875,"wires":[["ffc5562.e8a7728"]]},{"id":"1f814313.19e5b5","type":"join","z":"832b9098.9bc9c8","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"options","joiner":"\"","timeout":"1","count":"","x":514.7666015625,"y":448.5333251953125,"wires":[["d1f0ed4a.71ceb8"]]},{"id":"d1f0ed4a.71ceb8","type":"function","z":"832b9098.9bc9c8","name":"add msg.options","func":"msg.options = msg.payload;\nreturn msg;","outputs":"1","noerr":0,"x":744.7666320800781,"y":449.4832763671875,"wires":[["539764f3.85591c"]]},{"id":"fc2e4917.9fc65","type":"ui_button","z":"832b9098.9bc9c8","name":"","group":"ef8d993b.0a604","order":0,"width":0,"height":0,"label":"Start the model","color":"","icon":"","payload":"msg.payload","payloadType":"str","topic":"","x":107.7666015625,"y":849.4500122070312,"wires":[["92a1d7fb.38511","59fc75ba.1547e4"]]},{"id":"334b4f19.94c66","type":"exec","z":"832b9098.9bc9c8","command":"/usr/bin/sudo","addpay":true,"append":"","useSpawn":"","timer":"","name":"","x":1489.7666015625,"y":1037.2167358398438,"wires":[["aa11371e.736038"],["e7bbadf8.2d2cc8"],["2ca1628b.10b51e"]]},{"id":"a7338e40.6ad678","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"true","x":1407.88330078125,"y":931.3834228515625,"wires":[]},{"id":"8af5e536.16c4f","type":"function","z":"832b9098.9bc9c8","name":"set global variable","func":"var mymodel_local = msg.payload;\nflow.set(\"globalmodel\",mymodel_local)\n","outputs":1,"noerr":0,"x":1798,"y":458,"wires":[[]]},{"id":"6f9cd2b7.1a002c","type":"function","z":"832b9098.9bc9c8","name":"get global model","func":"var modelfetched = flow.get(\"globalmodel\");\nmsg.payload = modelfetched;\nreturn msg;","outputs":1,"noerr":0,"x":744,"y":901.0000610351562,"wires":[["f43a1a33.4185c","df4104bd.c37a"]]},{"id":"aa11371e.736038","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"payload","x":1748,"y":785.0000610351562,"wires":[]},{"id":"e7bbadf8.2d2cc8","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"true","x":1863,"y":943.0000610351562,"wires":[]},{"id":"2ca1628b.10b51e","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"payload","x":1880,"y":1011.0000610351562,"wires":[]},{"id":"32a2735e.a8284c","type":"ui_button","z":"832b9098.9bc9c8","name":"","group":"ef8d993b.0a604","order":0,"width":0,"height":0,"label":"Stop the Model","color":"","icon":"","payload":"","payloadType":"str","topic":"","x":131.00001525878906,"y":1965,"wires":[["484a4baa.1e830c"]]},{"id":"9d3194cb.423528","type":"function","z":"832b9098.9bc9c8","name":"concatenate command","func":"if (msg.payload === \"\")\n{\n //this is a leftover from the split node\n //or theres is no selected model\n //do nothing!\n}\nelse\n{\n var command = \"./\" + msg.payload + \".elf\";\n msg.payload = command;\n return msg;\n}","outputs":1,"noerr":0,"x":1175.88330078125,"y":1031.88330078125,"wires":[["a7338e40.6ad678","334b4f19.94c66"]]},{"id":"f43a1a33.4185c","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"true","x":1107.8833312988281,"y":807.0167236328125,"wires":[]},{"id":"df4104bd.c37a","type":"split","z":"832b9098.9bc9c8","name":"","splt":"\\n","x":926.7666625976562,"y":937.8167114257812,"wires":[["9d3194cb.423528","11e9ffc1.aac558"]]},{"id":"11e9ffc1.aac558","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"true","x":1179.88330078125,"y":862.0167236328125,"wires":[]},{"id":"e2796e56.b76d28","type":"ui_button","z":"832b9098.9bc9c8","name":"","group":"ca473521.47f448","order":2,"width":0,"height":0,"label":"Load Models on Raspberry Pi","color":"","icon":"","payload":"","payloadType":"date","topic":"","x":158.76666259765625,"y":225.61666870117188,"wires":[["c23ccc00.bd2218"]]},{"id":"c230df33.a9558","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"true","x":513.75,"y":1968.2666015625,"wires":[]},{"id":"3cde04fc.4c1e74","type":"ui_text","z":"832b9098.9bc9c8","group":"66840c1d.e10874","order":1,"width":0,"height":0,"name":"","label":"Selected Model","format":"{{msg.payload}}","layout":"row-spread","x":607.36669921875,"y":1331.25,"wires":[]},{"id":"4ae5fe10.460e98","type":"inject","z":"832b9098.9bc9c8","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"x":108.36666870117188,"y":1332,"wires":[["a49c6748.cdb808","1a9c5bf3.98f52c"]]},{"id":"3a1e70f9.773d8","type":"inject","z":"832b9098.9bc9c8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"x":111.36666870117188,"y":111,"wires":[["c3ff2c1.9201a5"]]},{"id":"58f0051c.8e398c","type":"function","z":"832b9098.9bc9c8","name":"set global modelname to \"\" once the flow starts","func":"var empty = \"\";\nflow.set(\"globalmodel\",empty); //initialisiere\n","outputs":1,"noerr":0,"x":622.36669921875,"y":113.5,"wires":[[]]},{"id":"a49c6748.cdb808","type":"function","z":"832b9098.9bc9c8","name":"get global model","func":"var modelfetched = flow.get(\"globalmodel\");\n\nif (modelfetched === \"\")\n{\n msg.payload = \"no model selected.\"\n}\nelse\n{\n msg.payload = modelfetched;\n}\n\nreturn msg;","outputs":"1","noerr":0,"x":308.75,"y":1331.75,"wires":[["3cde04fc.4c1e74"]]},{"id":"1a9c5bf3.98f52c","type":"function","z":"832b9098.9bc9c8","name":"get global model - check if model is selected","func":"var modelfetched = flow.get(\"globalmodel\");\n\nif (modelfetched === \"\")\n{\n msg.payload = \"no model selected.\";\n var local_status = \"nothing_selected\";\n flow.set(\"global_status\",local_status);\n return [null,msg]; //send to second output\n}\nelse\n{\n msg.payload = modelfetched;\n return [msg,null]; //send to first output\n}\n\n","outputs":"2","noerr":0,"x":360.75,"y":1658,"wires":[["8cc65388.f20238"],["b48ee169.bd06b"]]},{"id":"b48ee169.bd06b","type":"ui_text","z":"832b9098.9bc9c8","group":"66840c1d.e10874","order":0,"width":0,"height":0,"name":"","label":"Running Status","format":"{{msg.payload}}","layout":"row-spread","x":1993.36669921875,"y":2060.25,"wires":[]},{"id":"d35068fd.b46c1","type":"function","z":"832b9098.9bc9c8","name":"build pidof command","func":"if (msg.payload === \"\")\n{\n //this is a leftover from the split node\n //or theres is no selected model\n //do nothing!\n}\nelse\n{\nvar command = \"pidof \" +msg.payload+ \".elf\";\nmsg.payload = command;\nreturn msg;\n}\n\n","outputs":1,"noerr":0,"x":731.36669921875,"y":1654.25,"wires":[["2497ebc0.8a6c24"]]},{"id":"2497ebc0.8a6c24","type":"exec","z":"832b9098.9bc9c8","command":"/usr/bin/sudo","addpay":true,"append":"","useSpawn":"","timer":"","name":"","x":867.75,"y":1586.75,"wires":[["c1a74d4a.f31168"],[],[]]},{"id":"c3ff2c1.9201a5","type":"exec","z":"832b9098.9bc9c8","command":" cd /home/pi","addpay":false,"append":"","useSpawn":"","timer":"","name":"","x":309.75,"y":112,"wires":[["58f0051c.8e398c"],[],[]]},{"id":"6e2144cf.3871ec","type":"comment","z":"832b9098.9bc9c8","name":"Initialise global model name to \"\"","info":"","x":146.36666870117188,"y":73,"wires":[]},{"id":"fedb5756.b2dfa","type":"ui_text","z":"832b9098.9bc9c8","group":"e668aec.82a7d5","order":1,"width":"6","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":516.36669921875,"y":42.75,"wires":[]},{"id":"16574dc0.ef5712","type":"inject","z":"832b9098.9bc9c8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"x":129.36666870117188,"y":36,"wires":[["bade4f09.bcecf"]]},{"id":"bade4f09.bcecf","type":"function","z":"832b9098.9bc9c8","name":"Warning Text","func":"msg.payload = \"Only select models that were built using the DEPLOY TO HARDWARE option!\"\nreturn msg;","outputs":1,"noerr":0,"x":319.3666687011719,"y":34.5,"wires":[["fedb5756.b2dfa"]]},{"id":"8cc65388.f20238","type":"split","z":"832b9098.9bc9c8","name":"","splt":"\\n","x":549.75,"y":1586.25,"wires":[["d35068fd.b46c1"]]},{"id":"c1a74d4a.f31168","type":"function","z":"832b9098.9bc9c8","name":"generate status and set it globally --- output 2 = stopped -- output 1 = running","func":"//var result = msg.payload;\n\nvar local_status = \"\";\n\nif (msg.payload === null || msg.payload.match(/^ *$/) !== null)\n{\n local_status = \"stopped\";\n msg.payload = local_status;\n flow.set(\"global_status\",local_status);\n return [null,msg]; //send to second output\n}\nelse\n{\n local_status = \"running\";\n msg.payload = local_status;\n flow.set(\"global_status\",local_status)\n return [msg,null]; //send to first output\n}\n","outputs":"2","noerr":0,"x":1177.36669921875,"y":1675,"wires":[["c6a908d1.92ba58"],["b48ee169.bd06b"]]},{"id":"c6a908d1.92ba58","type":"function","z":"832b9098.9bc9c8","name":"","func":"\nreturn [msg,msg];","outputs":"2","noerr":0,"x":1599,"y":1698.75,"wires":[["ebcfcd8d.bbfbb8"],["20efca51.710b56"]]},{"id":"20efca51.710b56","type":"delay","z":"832b9098.9bc9c8","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1761,"y":1818.75,"wires":[["f2a5e12c.1523f8"]]},{"id":"f2a5e12c.1523f8","type":"trigger","z":"832b9098.9bc9c8","op1":"","op2":"...","op1type":"pay","op2type":"str","duration":"250","extend":false,"units":"ms","reset":"","name":"","x":1903,"y":1905.75,"wires":[["b48ee169.bd06b"]]},{"id":"7cc323ac.0003fc","type":"trigger","z":"832b9098.9bc9c8","op1":"","op2":"...","op1type":"pay","op2type":"str","duration":"250","extend":false,"units":"ms","reset":"","name":"","x":1991,"y":1834.75,"wires":[["b48ee169.bd06b"]]},{"id":"ebcfcd8d.bbfbb8","type":"delay","z":"832b9098.9bc9c8","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1819,"y":1751.75,"wires":[["7cc323ac.0003fc"]]},{"id":"92a1d7fb.38511","type":"delay","z":"832b9098.9bc9c8","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":248.86663818359375,"y":945.3999633789062,"wires":[["d8a6bf60.60ca7"]]},{"id":"6e5e4047.54381","type":"comment","z":"832b9098.9bc9c8","name":"wait for model status","info":"","x":279.3666687011719,"y":906,"wires":[]},{"id":"d8a6bf60.60ca7","type":"function","z":"832b9098.9bc9c8","name":"check model status: 1 = stopped; 2 = nothing_selected; 3 = running","func":"var model_status = \"\";\nvar model_status = flow.get(\"global_status\");\n\nif (model_status == \"stopped\") //OK\n{\n return [msg,null,null]; //send to first output\n}\nelse if (model_status == \"nothing_selected\")//notification to user\n{\n msg.payload = \"select a model first\"\n return [null,msg,null]; //send to second output\n}\nelse if (model_status == \"running\") //not OK\n{\n msg.payload = \"there is a model running already, make sure you stop it first.\"\n return [null,null,msg]; \n}\n\n","outputs":"3","noerr":0,"x":507.36669921875,"y":1065.9996948242188,"wires":[["6f9cd2b7.1a002c"],["8e9e3828.93ef18"],["e57c6eb1.1a8de8"]]},{"id":"8e9e3828.93ef18","type":"ui_toast","z":"832b9098.9bc9c8","position":"top right","displayTime":"3","name":"","x":1018.449951171875,"y":1135.8499755859375,"wires":[]},{"id":"e57c6eb1.1a8de8","type":"ui_toast","z":"832b9098.9bc9c8","position":"top right","displayTime":"3","name":"","x":1008.88330078125,"y":1203.949951171875,"wires":[]},{"id":"87940581.7e3b88","type":"ui_text","z":"832b9098.9bc9c8","group":"ef8d993b.0a604","order":0,"width":0,"height":0,"name":"","label":"Button Check","format":"{{msg.payload}}","layout":"row-spread","x":625.7666015625,"y":791.9666748046875,"wires":[]},{"id":"59fc75ba.1547e4","type":"function","z":"832b9098.9bc9c8","name":"","func":"msg.payload = \"checking model status...\";\nreturn msg;","outputs":1,"noerr":0,"x":301.76666259765625,"y":825.3500061035156,"wires":[["931c28bc.7e96"]]},{"id":"931c28bc.7e96","type":"trigger","z":"832b9098.9bc9c8","op1":"","op2":"idle","op1type":"pay","op2type":"str","duration":"1","extend":false,"units":"s","reset":"","name":"","x":443.7666320800781,"y":821.0499267578125,"wires":[["87940581.7e3b88"]]},{"id":"61bf655e.f7f53c","type":"inject","z":"832b9098.9bc9c8","name":"","topic":"","payload":"idle","payloadType":"str","repeat":"","crontab":"","once":true,"x":96.76666259765625,"y":753.0166320800781,"wires":[["87940581.7e3b88"]]},{"id":"24444a18.4cbc56","type":"comment","z":"832b9098.9bc9c8","name":"generate status for the currently selected model","info":"","x":202.36669921875,"y":1278,"wires":[]},{"id":"30ceebf1.a32f7c","type":"comment","z":"832b9098.9bc9c8","name":"get process id of currently selected model","info":"","x":938.36669921875,"y":1530,"wires":[]},{"id":"23067f78.970858","type":"comment","z":"832b9098.9bc9c8","name":"show status of currently selected model in UI","info":"","x":1934.36669921875,"y":1993,"wires":[]},{"id":"f8fbfdc7.c1911","type":"comment","z":"832b9098.9bc9c8","name":"start currently selected model","info":"","x":1549.7666320800781,"y":990.1166687011719,"wires":[]},{"id":"13a9f36.f129f8d","type":"split","z":"832b9098.9bc9c8","name":"","splt":"\\n","x":420.33331298828125,"y":2095.33349609375,"wires":[["9233f498.84e6b8"]]},{"id":"acad749.c898f08","type":"exec","z":"832b9098.9bc9c8","command":"/usr/bin/sudo","addpay":true,"append":"","useSpawn":"","timer":"","name":"","x":872.75,"y":2250.75,"wires":[["a659167.bb70d68"],[],[]]},{"id":"484a4baa.1e830c","type":"function","z":"832b9098.9bc9c8","name":"get currently selected model","func":"var ModelName = flow.get(\"globalmodel\");\nmsg.payload = ModelName;\nreturn msg;","outputs":1,"noerr":0,"x":316.4500274658203,"y":2034.9166259765625,"wires":[["13a9f36.f129f8d","c230df33.a9558"]]},{"id":"9233f498.84e6b8","type":"function","z":"832b9098.9bc9c8","name":"build pidof command","func":"if (msg.payload === \"\")\n{\n //this is a leftover from the split node\n //or theres is no selected model\n //do nothing!\n}\nelse\n{\nvar command = \"pidof \" +msg.payload+ \".elf\";\nmsg.payload = command;\nreturn msg;\n}\n\n","outputs":1,"noerr":0,"x":605.566650390625,"y":2174.566650390625,"wires":[["acad749.c898f08"]]},{"id":"a659167.bb70d68","type":"function","z":"832b9098.9bc9c8","name":"build kill command","func":"var command = \"\";\ncommand = \"kill \" + msg.payload;\nmsg.payload = command;\nreturn msg;","outputs":1,"noerr":0,"x":1167.449966430664,"y":2238.9166412353516,"wires":[["43184955.beabf8","cb19512.128fdb"]]},{"id":"43184955.beabf8","type":"exec","z":"832b9098.9bc9c8","command":"/usr/bin/sudo","addpay":true,"append":"","useSpawn":"","timer":"","name":"","x":1453.566650390625,"y":2261.1663818359375,"wires":[["14bf4243.eed376"],["a134f8bc.13307"],["ac6e366e.9f6e68"]]},{"id":"cb19512.128fdb","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"true","x":1400.566650390625,"y":2138.1663818359375,"wires":[]},{"id":"14bf4243.eed376","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"true","x":1644.566650390625,"y":2152.16650390625,"wires":[]},{"id":"a134f8bc.13307","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"true","x":1664.566650390625,"y":2211.566650390625,"wires":[]},{"id":"ac6e366e.9f6e68","type":"debug","z":"832b9098.9bc9c8","name":"","active":true,"console":"false","complete":"true","x":1671.566650390625,"y":2276.566650390625,"wires":[]},{"id":"f8302f9.95fe45","type":"function","z":"832b9098.9bc9c8","name":"check model status: 1 = stopped; 2 = nothing_selected; 3 = running","func":"var model_status = \"\";\nvar model_status = flow.get(\"global_status\");\n\nif (model_status == \"stopped\") //OK\n{\n return [msg,null,null]; //send to first output\n}\nelse if (model_status == \"nothing_selected\")//notification to user\n{\n \n return [null,msg,null]; //send to second output\n}\nelse if (model_status == \"running\") //not OK\n{\n msg.payload = \"there is a model running already, make sure you stop it before you select another.\"\n return [null,null,msg]; \n}\n\n","outputs":"3","noerr":0,"x":1333.566650390625,"y":566.9666748046875,"wires":[["8af5e536.16c4f"],["8af5e536.16c4f"],["36beb8f9.881218"]]},{"id":"36beb8f9.881218","type":"ui_toast","z":"832b9098.9bc9c8","position":"top right","displayTime":"3","name":"","x":1794.566650390625,"y":593.9666748046875,"wires":[]},{"id":"c23ccc00.bd2218","type":"delay","z":"832b9098.9bc9c8","name":"","pauseType":"delay","timeout":"1.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":228.4499969482422,"y":270.1499786376953,"wires":[["26c2d2c0.9e320e"]]},{"id":"ffc5562.e8a7728","type":"delay","z":"832b9098.9bc9c8","name":"","pauseType":"delay","timeout":"1.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1102.449966430664,"y":502.1499786376953,"wires":[["f8302f9.95fe45"]]},{"id":"ca473521.47f448","type":"ui_group","z":"","name":"Model Selection","tab":"93b1b6f5.db1b4","order":2,"disp":true,"width":"6"},{"id":"ef8d993b.0a604","type":"ui_group","z":"","name":"Model Control","tab":"93b1b6f5.db1b4","order":3,"disp":true,"width":"6"},{"id":"66840c1d.e10874","type":"ui_group","z":"","name":"Model Status","tab":"93b1b6f5.db1b4","order":4,"disp":true,"width":"6"},{"id":"e668aec.82a7d5","type":"ui_group","z":"","name":"WARNING","tab":"93b1b6f5.db1b4","order":1,"disp":true,"width":"6"},{"id":"93b1b6f5.db1b4","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]