Uptime display in DD:HH:MM:SS.
-
-
Save Frodo69/5d7ae80df50c43e736a57f60864be95b to your computer and use it in GitHub Desktop.
Uptime in DD:HH:MM:SS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"177ae28f.b66a45","type":"inject","z":"2315e797.535f38","name":"","topic":"","payload":"1","payloadType":"num","repeat":"1","crontab":"","once":false,"x":150,"y":480,"wires":[["d2b43b13.c01ea8"]]},{"id":"50f9790b.49c718","type":"function","z":"2315e797.535f38","name":"Seconds to DD:HH:MM:SS","func":" var totalNumberOfSeconds = msg.count;\n var days = parseInt( totalNumberOfSeconds / 86400 );\n var hours = parseInt (( totalNumberOfSeconds - ( days * 86400 )) / 3600 );\n var minutes = parseInt ((totalNumberOfSeconds - ((hours * 3600)+( days * 86400 ))) / 60 );\n var seconds = parseInt(totalNumberOfSeconds - ((hours * 3600) + (minutes * 60)+( days * 86400 )));\n var result = (days < 10 ? \"0\" + days : days) + \":\" + (hours < 10 ? \"0\" + hours : hours) + \":\" + (minutes < 10 ? \"0\" + minutes : minutes) + \":\" + (seconds < 10 ? \"0\" + seconds : seconds);\n msg.payload=result;\n return msg;","outputs":1,"noerr":0,"x":680,"y":500,"wires":[["4f6abcf.71f1a44"]]},{"id":"4f6abcf.71f1a44","type":"ui_text","z":"2315e797.535f38","group":"9d152790.9d9de8","order":0,"width":0,"height":0,"name":"Up-Time Node Red","label":"UpTime","format":"{{msg.payload}}","layout":"row-center","x":950,"y":500,"wires":[]},{"id":"d2b43b13.c01ea8","type":"counter","z":"2315e797.535f38","name":"","init":"0","step":"1","lower":"","upper":"","mode":"increment","outputs":"1","x":445,"y":497,"wires":[["50f9790b.49c718"]]},{"id":"9d152790.9d9de8","type":"ui_group","z":"","name":"Uptime","tab":"2926be0.7270bc2","order":3,"disp":true,"width":"6"},{"id":"2926be0.7270bc2","type":"ui_tab","z":"","name":"Configuration","icon":"dashboard","order":2}] |
Counter:
https://flows.nodered.org/node/node-red-contrib-counter
This is the only one I can think of for time:
https://www.npmjs.com/package/time
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where can I find Node-Red functions Counter and Time? Those are listed as missing when I try to deploy this. Thank you