Node-red counter

I have for a indication the running-time a counter with a trigger for minutes-puls
after the job is finish, i like to reset this counter to zero (0)
the prescription say, "Use msg.reset for reset the counter to 0."
but I'm not able to perform this
can somebody give me a tip to solve this problem?
thank you very much

Are you sure you are setting msg.reset and not msg.payload.reset? If you think you are doing it right then tell us how you are setting msg.reset.

Try

msg.reset = true;
return msg;

I did this to reset my counter.

msg.reset="0";
return msg;

Actually this is no reset but overwriting my counter by 0. Maybe this will help.

1 Like

Here the part I am using incrementing, decrementing and reset my counter.

'''[{"id":"bec935a3.98b75","type":"inject","z":"487156a4.3a2338","name":"decrement","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":335.8833312988281,"y":522.88330078125,"wires":[["bc1de050.491f98"]]},{"id":"8d22dd31.8495f","type":"inject","z":"487156a4.3a2338","name":"increment","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":335.8833312988281,"y":482.88330078125,"wires":[["5e368c1.8e22f74"]]},{"id":"dc3ba493.e19b8","type":"inject","z":"487156a4.3a2338","name":"reset","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":325.8833312988281,"y":562.88330078125,"wires":[["e070ec23.46e298"]]},{"id":"5e368c1.8e22f74","type":"function","z":"487156a4.3a2338","name":"msg object","func":"msg.increment = 0.0614;\nreturn msg;","outputs":1,"noerr":0,"x":505.8833312988281,"y":482.88330078125,"wires":[["ec0aac11.59f39"]]},{"id":"e070ec23.46e298","type":"function","z":"487156a4.3a2338","name":"msg object","func":"msg.reset="0";\nreturn msg;","outputs":1,"noerr":0,"x":505.8833312988281,"y":562.88330078125,"wires":[["ec0aac11.59f39"]]},{"id":"bc1de050.491f98","type":"function","z":"487156a4.3a2338","name":"msg object","func":"msg.decrement = 0.0614;\nreturn msg;","outputs":1,"noerr":0,"x":505.8833312988281,"y":522.88330078125,"wires":[["ec0aac11.59f39"]]},{"id":"cfa2a769.e50bf8","type":"debug","z":"487156a4.3a2338","name":"count","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":893.88330078125,"y":495.8833312988281,"wires":[]},{"id":"ec0aac11.59f39","type":"counter","z":"487156a4.3a2338","name":"","init":"0","step":"0","lower":"","upper":"","mode":"increment","outputs":2,"x":695.8833312988281,"y":502.88330078125,"wires":[["cfa2a769.e50bf8","f73dcbcd.08a268"],[]]}]'''

thanks! it works by msg.reset = true; return msg;

thank you, yessss it will be, that I have sent the msg.payload.reset

it works now as well with your tip !!!

:grinning::+1: