Uptime in DD:HH:MM:SS

Uptime display in DD:HH:MM:SS.

[{"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}]
Frodo69

Flow Info

created 1 week, 3 days ago

Node Types

Core
  • function (x1)
  • inject (x1)
Other
  • counter (x1)
  • ui_group (x1)
  • ui_tab (x1)
  • ui_text (x1)

Tags

  • Time
  • Counter
  • HH:DD:MM:SS
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option