Can someone tell me why I cant get the Hour out of this time formatting node.
It is like there is a set var. that is "2"
I have the same settings as the one below.
[{"id":"f94f3a76a143067f","type":"debug","z":"9ef76333.a9baf","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1130,"y":1320,"wires":[]},{"id":"d80e4ff98db0c5b3","type":"dsm","z":"9ef76333.a9baf","name":"Time tæller","sm_config":"{\n \"currentState\": \"stopped\",\n \"states\": {\n \"stopped\": {\n \"on\": \"started\"\n },\n \"started\": {\n \"inc\": \"counting\",\n \"off\": \"stopped\"\n },\n \"counting\": {\n \"inc\": \"counting\",\n \"off\": \"stopped\"\n }\n },\n \"data\": {\n \"prev_time\": null,\n \"time\": 0,\n \"seconds\": 0,\n \"interval\": 1,\n \"interval_output\": true,\n \"hms_format\": true\n },\n \"methods\": {\n \"init\": [\n \"sm.calc_time = function() {\",\n \" var now = Date.now();\",\n \" sm.data.time += now - sm.data.prev_time;\",\n \" sm.data.prev_time = now;\",\n \" sm.data.seconds = Math.round(sm.data.time / 1000);\",\n \"};\",\n \"sm.sec2hhmmss = function(sec) {\",\n \"var t = {};\",\n \"t.h = pad(Math.floor(sec / 3600));\",\n \"sec %= 3600;\",\n \"t.m = pad(Math.floor(sec / 60));\",\n \"t.s = pad(sec % 60);\",\n \"return t.h+':'+t.m+':'+t.s;\",\n \"};\"\n ],\n \"on\": [\n \"if (sm.currentState === 'started') {\",\n \" sm.data.prev_time = Date.now();\",\n \" resume('inc', msg);\",\n \"}\",\n \"output = false;\"\n ],\n \"inc\": [\n \"timeout.interval = setTimeout(function() {\",\n \" sm.calc_time();\",\n \" msg.data = sm.data;\",\n \" if (sm.data.interval_output) {\",\n \" msg.payload = sm.data.hms_format ? sm.sec2hhmmss(sm.data.seconds): sm.data.seconds;\",\n \" node.send(msg);\",\n \" }\",\n \" resume('inc', msg);\",\n \"}, sm.data.interval*1000);\",\n \"output = false;\"\n ],\n \"off\": [\n \"clearTimeout(timeout.interval);\",\n \"sm.calc_time();\",\n \"msg.payload = sm.data.hms_format ? sm.sec2hhmmss(sm.data.seconds): sm.data.seconds;\"\n ],\n \"reset\": [\n \"sm.data.time = 0;\",\n \"sm.data.seconds = 0;\"\n ],\n \"status\": {\n \"fill\": {\n \"get\": \"sm.currentState === 'counting' ? 'green' : 'grey';\"\n },\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"'time ' + (sm.data.hms_format ? sm.sec2hhmmss(sm.data.seconds): sm.data.seconds);\"\n }\n }\n }\n}\n","x":1140,"y":1260,"wires":[["f94f3a76a143067f","88dea60ccd09075f","794d2cf87c4ccb6f"]]},{"id":"88dea60ccd09075f","type":"moment","z":"9ef76333.a9baf","name":"Format time","topic":"","input":"payload","inputType":"msg","inTz":"Africa/Abidjan","adjAmount":"0","adjType":"seconds","adjDir":"add","format":"hh:mm:ss","locale":"en-US","output":"time","outputType":"msg","outTz":"Europe/Copenhagen","x":1350,"y":1320,"wires":[["fbf03a44ec3e1a23"]]},{"id":"794d2cf87c4ccb6f","type":"moment","z":"9ef76333.a9baf","name":"test time","topic":"","input":"payload","inputType":"msg","inTz":"Africa/Abidjan","adjAmount":"0","adjType":"seconds","adjDir":"add","format":"hh:mm:ss","locale":"en-US","output":"time","outputType":"msg","outTz":"Europe/Copenhagen","x":1340,"y":1260,"wires":[["b3063e4d8f941d2d","22b87c4e1f149913"]]}]