Hello,
I have a problem with converting and displaying milliseconds in the format dd hh mm ss.
I have 3 phases L1 L2 L3 and I want to add them together. This works so far, but with the conversion into the time format with display I have my problems.
Enclosed is the flow
[{"id":"a1ebb142b4c16134","type":"hourglass","z":"ab223f70ef9714e4","name":"","persistId":"","humanizeLocale":"de","x":700,"y":240,"wires":[["172a6aae37c048b7","8412c739ddf6844c","8b080acf89328693"]]},{"id":"7c58b0ce0bfb8638","type":"change","z":"ab223f70ef9714e4","name":"{command:'reset'}","rules":[{"t":"set","p":"command","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":413,"y":340,"wires":[["1f6bc49396a41d57","a1ebb142b4c16134"]]},{"id":"dc825e0cf24a40da","type":"change","z":"ab223f70ef9714e4","name":"{command:'start'}","rules":[{"t":"set","p":"command","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":411,"y":240,"wires":[["1f6bc49396a41d57","a1ebb142b4c16134"]]},{"id":"6d1064821703a422","type":"change","z":"ab223f70ef9714e4","name":"{command:'stop'}","rules":[{"t":"set","p":"command","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":411,"y":280,"wires":[["1f6bc49396a41d57","a1ebb142b4c16134"]]},{"id":"172a6aae37c048b7","type":"debug","z":"ab223f70ef9714e4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"elapsed.millis","targetType":"msg","x":930,"y":240,"wires":[]},{"id":"1f6bc49396a41d57","type":"debug","z":"ab223f70ef9714e4","name":"last command","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"command","targetType":"msg","x":710,"y":300,"wires":[]},{"id":"f03307ba4aa80b17","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":280,"wires":[["6d1064821703a422"]]},{"id":"9496e44d13b49be8","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":340,"wires":[["7c58b0ce0bfb8638"]]},{"id":"f367d10cf563c135","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":240,"wires":[["dc825e0cf24a40da"]]},{"id":"2d29725919667220","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":380,"wires":[["d4a7783041f5f5ee"]]},{"id":"d4a7783041f5f5ee","type":"change","z":"ab223f70ef9714e4","name":"{command:'status'}","rules":[{"t":"set","p":"command","pt":"msg","to":"status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":411,"y":380,"wires":[["a1ebb142b4c16134","1f6bc49396a41d57"]]},{"id":"f10939ec9446df40","type":"hourglass","z":"ab223f70ef9714e4","name":"","persistId":"","humanizeLocale":"de","x":700,"y":520,"wires":[["63158f84c75c4952","5213156e8a852b9a","72a02534cde2d5a5"]]},{"id":"745039475fb5a097","type":"change","z":"ab223f70ef9714e4","name":"{command:'reset'}","rules":[{"t":"set","p":"command","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":413,"y":620,"wires":[["e65a918d600b05a6","f10939ec9446df40"]]},{"id":"996e60d24b66c754","type":"change","z":"ab223f70ef9714e4","name":"{command:'start'}","rules":[{"t":"set","p":"command","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":411,"y":520,"wires":[["e65a918d600b05a6","f10939ec9446df40"]]},{"id":"c5fbf5595e129758","type":"change","z":"ab223f70ef9714e4","name":"{command:'stop'}","rules":[{"t":"set","p":"command","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":411,"y":560,"wires":[["e65a918d600b05a6","f10939ec9446df40"]]},{"id":"63158f84c75c4952","type":"debug","z":"ab223f70ef9714e4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"elapsed.millis","targetType":"msg","x":930,"y":520,"wires":[]},{"id":"e65a918d600b05a6","type":"debug","z":"ab223f70ef9714e4","name":"last command","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"command","targetType":"msg","x":710,"y":580,"wires":[]},{"id":"193d3e08c95ed53e","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":560,"wires":[["c5fbf5595e129758"]]},{"id":"64e8fd0d8bda81c2","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":620,"wires":[["745039475fb5a097"]]},{"id":"0ffc7961b40a3d5f","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":520,"wires":[["996e60d24b66c754"]]},{"id":"ff4563fd38183709","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":660,"wires":[["6e2c21a552e5047e"]]},{"id":"6e2c21a552e5047e","type":"change","z":"ab223f70ef9714e4","name":"{command:'status'}","rules":[{"t":"set","p":"command","pt":"msg","to":"status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":411,"y":660,"wires":[["f10939ec9446df40","e65a918d600b05a6"]]},{"id":"8412c739ddf6844c","type":"function","z":"ab223f70ef9714e4","name":"function 20","func":"// Time HH:MM:SS from number\n// Hours\nvar Hours = ((msg.payload) / 3600);\nvar hours = Math.floor(Hours);\n// Minutes\nvar Minutes = (msg.payload - (Hours * 3600)) / 60;\nvar Minutes = Math.floor(Minutes);\n// Seconds\nvar Seconds = (msg.payload - (Hours* 3600) - (Minutes * 60));\n// Concatenate\nvar Time = ('0' + Hours).slice(-2) + ':' + ('0' + Minutes).slice(-2) + ':' + ('0' + Seconds).slice(-2);\nmsg.payload = Time;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":300,"wires":[["4dae37618d67f71e"]]},{"id":"4dae37618d67f71e","type":"ui_text","z":"ab223f70ef9714e4","group":"ca29b1fcd817a3a8","order":2,"width":4,"height":1,"name":"txt L1 GZ","label":"L1","format":"{{msg.elapsed.time.days}}d {{msg.elapsed.time.hours}}h {{msg.elapsed.time.minutes}}m {{msg.elapsed.time.seconds}}s","layout":"row-spread","className":"","x":1180,"y":300,"wires":[]},{"id":"8b080acf89328693","type":"function","z":"ab223f70ef9714e4","name":"variable g_gtL1","func":"var g_gtL1 = global.get('g_gtL1') || 0;\ng_gtL1 = Number(msg.elapsed.millis);\nglobal.set('g_gtL1', g_gtL1)\nmsg.payload = g_gtL1;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":360,"wires":[["e360eb2df76f367a"]]},{"id":"e360eb2df76f367a","type":"debug","z":"ab223f70ef9714e4","name":"debug 80","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1180,"y":360,"wires":[]},{"id":"5213156e8a852b9a","type":"function","z":"ab223f70ef9714e4","name":"function 21","func":"// Time HH:MM:SS from number\n// Hours\nvar Hours = ((msg.payload) / 3600);\nvar hours = Math.floor(Hours);\n// Minutes\nvar Minutes = (msg.payload - (Hours * 3600)) / 60;\nvar Minutes = Math.floor(Minutes);\n// Seconds\nvar Seconds = (msg.payload - (Hours* 3600) - (Minutes * 60));\n// Concatenate\nvar Time = ('0' + Hours).slice(-2) + ':' + ('0' + Minutes).slice(-2) + ':' + ('0' + Seconds).slice(-2);\nmsg.payload = Time;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":580,"wires":[["1e6012318787337a"]]},{"id":"72a02534cde2d5a5","type":"function","z":"ab223f70ef9714e4","name":"variable g_gtL2","func":"var g_gtL2 = global.get('g_gtL2') || 0;\ng_gtL2 = Number(msg.elapsed.millis);\nglobal.set('g_gtL2', g_gtL2)\nmsg.payload = g_gtL2;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":640,"wires":[["b6dba36e0ed0f958"]]},{"id":"b6dba36e0ed0f958","type":"debug","z":"ab223f70ef9714e4","name":"debug 81","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1180,"y":640,"wires":[]},{"id":"1e6012318787337a","type":"ui_text","z":"ab223f70ef9714e4","group":"ca29b1fcd817a3a8","order":4,"width":4,"height":1,"name":"txt L2 GZ","label":"L2","format":"{{msg.elapsed.time.days}}d {{msg.elapsed.time.hours}}h {{msg.elapsed.time.minutes}}m {{msg.elapsed.time.seconds}}s","layout":"row-spread","className":"","x":1180,"y":580,"wires":[]},{"id":"7acb117175fed63d","type":"function","z":"ab223f70ef9714e4","name":"function 22","func":"// Time HH:MM:SS from number\n// Hours\nvar Hours = ((msg.payload) / 3600);\nvar hours = Math.floor(Hours);\n// Minutes\nvar Minutes = (msg.payload - (Hours * 3600)) / 60;\nvar Minutes = Math.floor(Minutes);\n// Seconds\nvar Seconds = (msg.payload - (Hours* 3600) - (Minutes * 60));\n// Concatenate\nvar Time = ('0' + Hours).slice(-2) + ':' + ('0' + Minutes).slice(-2) + ':' + ('0' + Seconds).slice(-2);\nmsg.payload = Time;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":840,"wires":[["7acb93fba7392e49"]]},{"id":"322c967ec5d950da","type":"function","z":"ab223f70ef9714e4","name":"variable g_gtL3","func":"var g_gtL3 = global.get('g_gtL3') || 0;\ng_gtL3 = Number(msg.elapsed.millis);\nglobal.set('g_gtL3', g_gtL3)\nmsg.payload = g_gtL3;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":900,"wires":[["4b630659327335b3"]]},{"id":"7acb93fba7392e49","type":"ui_text","z":"ab223f70ef9714e4","group":"ca29b1fcd817a3a8","order":6,"width":4,"height":1,"name":"txt L3 GZ","label":"L3","format":"{{msg.elapsed.time.days}}d {{msg.elapsed.time.hours}}h {{msg.elapsed.time.minutes}}m {{msg.elapsed.time.seconds}}s","layout":"row-spread","className":"","x":1180,"y":840,"wires":[]},{"id":"a83e49f9fef76d95","type":"hourglass","z":"ab223f70ef9714e4","name":"","persistId":"","humanizeLocale":"de","x":700,"y":780,"wires":[["96f0b87aec008694","7acb117175fed63d","322c967ec5d950da","94993c411838482b"]]},{"id":"15f31d7dbe3844ba","type":"change","z":"ab223f70ef9714e4","name":"{command:'reset'}","rules":[{"t":"set","p":"command","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":413,"y":880,"wires":[["8749db4dcd7109cd","a83e49f9fef76d95"]]},{"id":"9d5afa489aadc18b","type":"change","z":"ab223f70ef9714e4","name":"{command:'start'}","rules":[{"t":"set","p":"command","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":411,"y":780,"wires":[["8749db4dcd7109cd","a83e49f9fef76d95"]]},{"id":"1bc4f55112725a18","type":"change","z":"ab223f70ef9714e4","name":"{command:'stop'}","rules":[{"t":"set","p":"command","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":411,"y":820,"wires":[["8749db4dcd7109cd","a83e49f9fef76d95"]]},{"id":"8749db4dcd7109cd","type":"debug","z":"ab223f70ef9714e4","name":"last command","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"command","targetType":"msg","x":710,"y":840,"wires":[]},{"id":"a947450bc94f3f81","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":820,"wires":[["1bc4f55112725a18"]]},{"id":"ea55c5d89546bdaf","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":880,"wires":[["15f31d7dbe3844ba"]]},{"id":"116f3edac4b6e7aa","type":"inject","z":"ab223f70ef9714e4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":199,"y":780,"wires":[["9d5afa489aadc18b"]]},{"id":"5f155b6f8f1d707a","type":"inject","z":"ab223f70ef9714e4","name":"","props":[{"p":"payload","v":"","vt":"str"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":90,"y":920,"wires":[["fc15dd457444f4ed","6db784678c3195df","6e2c21a552e5047e","d4a7783041f5f5ee"]]},{"id":"fc15dd457444f4ed","type":"change","z":"ab223f70ef9714e4","name":"{command:'status'}","rules":[{"t":"set","p":"command","pt":"msg","to":"status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":411,"y":920,"wires":[["a83e49f9fef76d95","8749db4dcd7109cd"]]},{"id":"96f0b87aec008694","type":"debug","z":"ab223f70ef9714e4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"elapsed.millis","targetType":"msg","x":930,"y":780,"wires":[]},{"id":"4b630659327335b3","type":"debug","z":"ab223f70ef9714e4","name":"debug 91","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1180,"y":900,"wires":[]},{"id":"6db784678c3195df","type":"function","z":"ab223f70ef9714e4","name":"Addition L1 L2 L3 gesamt","func":"var g_gtL1 = global.get('g_gtL1');\nvar g_gtL2 = global.get('g_gtL2');\nvar g_gtL3 = global.get('g_gtL3');\nvar msg_gtL123 = Number(g_gtL1) + Number(g_gtL2) + Number(g_gtL3);\nmsg.payload = msg_gtL123;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":670,"y":1120,"wires":[["e26037c6705eeca3","e8227be06fac0bd0"]]},{"id":"e26037c6705eeca3","type":"function","z":"ab223f70ef9714e4","name":"Umrechnung millis in Zeit","func":"// Time HH:MM:SS from number\n// Hours\nvar Hours = ((msg.payload) / 3600);\nvar hours = Math.floor(Hours);\n// Minutes\nvar Minutes = (msg.payload - (Hours * 3600)) / 60;\nvar Minutes = Math.floor(Minutes);\n// Seconds\nvar Seconds = (msg.payload - (Hours* 3600) - (Minutes * 60));\n// Concatenate\nvar Time = ('0' + Hours).slice(-2) + ':' + ('0' + Minutes).slice(-2) + ':' + ('0' + Seconds).slice(-2);\nmsg.payload = Time;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":1120,"wires":[["6750bf5c91d7f94d","6dea868ecd29d75f"]]},{"id":"6750bf5c91d7f94d","type":"ui_text","z":"ab223f70ef9714e4","group":"ca29b1fcd817a3a8","order":10,"width":4,"height":1,"name":"txt Gesamt L1/L2/L3","label":"Gesamt L1/L2/L3","format":"{{msg.elapsed.time.days}}d {{msg.elapsed.time.hours}}h {{msg.elapsed.time.minutes}}m {{msg.elapsed.time.seconds}}s","layout":"row-spread","className":"","x":1180,"y":1120,"wires":[]},{"id":"e8227be06fac0bd0","type":"debug","z":"ab223f70ef9714e4","name":"debug 92","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":880,"y":1180,"wires":[]},{"id":"6dea868ecd29d75f","type":"debug","z":"ab223f70ef9714e4","name":"debug 93","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1140,"y":1180,"wires":[]},{"id":"94993c411838482b","type":"debug","z":"ab223f70ef9714e4","name":"debug 94","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1180,"y":960,"wires":[]},{"id":"ca29b1fcd817a3a8","type":"ui_group","name":"Zähler Gesamtlaufzeit","tab":"1df1d979d4e318b9","order":2,"disp":true,"width":5,"collapse":false,"className":""},{"id":"1df1d979d4e318b9","type":"ui_tab","name":"Betriebsstundenzähler","icon":"fa-clock-o","order":7,"disabled":false,"hidden":false}]
The individual 3 phases L1 L2 L3 work, but I can't get it to work as a sum.
Thanks for the help
Many greetings
Roland