Count timer lamp

#1

hello i want count time of power on of my pump.
and i want reset.
i use function count.
i have the problem for trasform second in format HH:MM:SS
and reset count thanks


[{"id":"df04f0a9.f712d","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"28b8d977.5f1186","type":"trigger","z":"df04f0a9.f712d","op1":"1","op2":"0","op1type":"num","op2type":"str","duration":"-1","extend":false,"units":"s","reset":"0","bytopic":"all","name":"","x":337.0235061645508,"y":505.03907537460327,"wires":[["bffbc3b8.42a91"]]},{"id":"9b6c077d.0ecd08","type":"ui_text","z":"df04f0a9.f712d","group":"582f1b9b.d2b844","order":2,"width":"0","height":"0","name":"","label":"","format":"{{count}}","layout":"row-center","x":1108.0234642028809,"y":505.03906059265137,"wires":[]},{"id":"82286ffa.20bdd","type":"arduino in","z":"df04f0a9.f712d","name":"","pin":"7","state":"INPUT","arduino":"e783fd84.9c46e","x":135.02344131469727,"y":506.0390911102295,"wires":[["28b8d977.5f1186"]],"icon":"node-red/arduino.png"},{"id":"648ad301.88891c","type":"counter","z":"df04f0a9.f712d","name":"","init":"0","step":"1","lower":null,"upper":null,"mode":"increment","outputs":"1","x":765.5234489440918,"y":507.3722515106201,"wires":[[]]},{"id":"bffbc3b8.42a91","type":"function","z":"df04f0a9.f712d","name":"msg object","func":"msg.increment = 1;\nreturn msg;","outputs":1,"noerr":0,"x":546.0234489440918,"y":504.37228202819824,"wires":[["648ad301.88891c"]]},{"id":"60b78000.eb1f1","type":"ui_button","z":"df04f0a9.f712d","name":"","group":"582f1b9b.d2b844","order":4,"width":0,"height":0,"passthru":false,"label":"reset tempo","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":405.02344512939453,"y":629.0390605926514,"wires":[["5c55b08e.a72a5"]]},{"id":"5c55b08e.a72a5","type":"function","z":"df04f0a9.f712d","name":"msg object","func":"msg.reset = true;\nreturn msg;","outputs":1,"noerr":0,"x":565.0234298706055,"y":629.0390605926514,"wires":[["648ad301.88891c"]]},{"id":"582f1b9b.d2b844","type":"ui_group","z":"","name":"Default","tab":"e1287607.22b828","disp":true,"width":"6","collapse":false},{"id":"e783fd84.9c46e","type":"arduino-board","z":"","device":"COM3"},{"id":"e1287607.22b828","type":"ui_tab","z":"","name":"home","icon":"dashboard"}]

0 Likes

#2

Can you provide links to the specific nodes you have used - i fail to import as 3 nodes are missing - Arduino, Ardunio in and Count

Craig

0 Likes

#3

can you try.....insert a function..

var time = (new Date(msg.payload * 1000)).toUTCString().match(/(\d\d:\d\d:\d\d)/)[0];
msg.payload = time;
return msg;

0 Likes