For the flow you posted, and from what I can determine, it is because the count
nodes are not being reset.
(I know. It took me a while to work it out too as it doesn't show in the context
part.)
If you add an inject
node and a change
node and set the change node
to:
msg.reset
to true
and then connect that to the two count
nodes, all will work.
Flow attached.
[{"id":"1769e25f.80e366","type":"delay","z":"9245b569.9f881","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":510,"y":300,"wires":[["29342d7e.cb24ba"]]},{"id":"dedc45f6.d3c3f","type":"counter","z":"9245b569.9f881","name":"","init":"0","step":"1","lower":"0","upper":"50","mode":"increment","outputs":"1","x":740,"y":380,"wires":[["c1887c16.21b7c","1769e25f.80e366"]]},{"id":"29342d7e.cb24ba","type":"while-loop","z":"9245b569.9f881","name":"","condi":"msg.count >= 50","x":530,"y":380,"wires":[["dedc45f6.d3c3f"],["3c581622.355d3a"]]},{"id":"c1887c16.21b7c","type":"debug","z":"9245b569.9f881","name":"Counter 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"count","targetType":"msg","x":910,"y":380,"wires":[]},{"id":"7382287b.d8deb8","type":"change","z":"9245b569.9f881","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":260,"wires":[["dedc45f6.d3c3f","637d7415.3e256c"]]},{"id":"d353526b.10f908","type":"change","z":"9245b569.9f881","name":"","rules":[{"t":"set","p":"count","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":220,"y":380,"wires":[["29342d7e.cb24ba"]]},{"id":"3c581622.355d3a","type":"while-loop","z":"9245b569.9f881","name":"","condi":"msg.count <= 1","x":520,"y":520,"wires":[["637d7415.3e256c"],["80540ca2.94228"]]},{"id":"5fbf9068.7c242","type":"inject","z":"9245b569.9f881","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":340,"y":260,"wires":[["7382287b.d8deb8"]]},{"id":"637d7415.3e256c","type":"counter","z":"9245b569.9f881","name":"","init":"50","step":"1","lower":"0","upper":"50","mode":"decrement","outputs":"1","x":730,"y":520,"wires":[["4eaa3847.728c88","5b1a2de.3b79354"]]},{"id":"a71092a9.33f908","type":"ui_button","z":"9245b569.9f881","name":"b_test2","group":"a37c47f0.d5982","order":1,"width":0,"height":0,"passthru":false,"label":"test Alarm","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":200,"y":320,"wires":[["d353526b.10f908"]]},{"id":"80540ca2.94228","type":"debug","z":"9245b569.9f881","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":900,"y":570,"wires":[]},{"id":"5b1a2de.3b79354","type":"delay","z":"9245b569.9f881","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":510,"y":460,"wires":[["3c581622.355d3a"]]},{"id":"4eaa3847.728c88","type":"debug","z":"9245b569.9f881","name":"Counter 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"count","targetType":"msg","x":910,"y":520,"wires":[]},{"id":"a37c47f0.d5982","type":"ui_group","z":"","name":"Home","tab":"c5a1d7ad.7858","order":1,"disp":true,"width":"6","collapse":false},{"id":"c5a1d7ad.7858","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
Or!
To make it even simpler - as I am guessing you want to be able to use this over and over:
You can adjust the delay
node as needed. It actually may not be needed. I put it in just for the sake of making sure the signals don't trip over each other.
[{"id":"a71092a9.33f908","type":"ui_button","z":"9245b569.9f881","name":"b_test2","group":"a37c47f0.d5982","order":1,"width":0,"height":0,"passthru":false,"label":"test Alarm","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":200,"y":280,"wires":[["7c1c1aed.d95d3c","7382287b.d8deb8"]]},{"id":"7c1c1aed.d95d3c","type":"delay","z":"9245b569.9f881","name":"","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":210,"y":330,"wires":[["d353526b.10f908"]]},{"id":"7382287b.d8deb8","type":"change","z":"9245b569.9f881","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":260,"wires":[["dedc45f6.d3c3f","637d7415.3e256c"]]},{"id":"d353526b.10f908","type":"change","z":"9245b569.9f881","name":"","rules":[{"t":"set","p":"count","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":220,"y":380,"wires":[["29342d7e.cb24ba"]]},{"id":"dedc45f6.d3c3f","type":"counter","z":"9245b569.9f881","name":"","init":"0","step":"1","lower":"0","upper":"50","mode":"increment","outputs":"1","x":740,"y":380,"wires":[["c1887c16.21b7c","1769e25f.80e366"]]},{"id":"637d7415.3e256c","type":"counter","z":"9245b569.9f881","name":"","init":"50","step":"1","lower":"0","upper":"50","mode":"decrement","outputs":"1","x":730,"y":520,"wires":[["4eaa3847.728c88","5b1a2de.3b79354"]]},{"id":"29342d7e.cb24ba","type":"while-loop","z":"9245b569.9f881","name":"","condi":"msg.count >= 50","x":530,"y":380,"wires":[["dedc45f6.d3c3f"],["3c581622.355d3a"]]},{"id":"c1887c16.21b7c","type":"debug","z":"9245b569.9f881","name":"Counter 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"count","targetType":"msg","x":910,"y":380,"wires":[]},{"id":"1769e25f.80e366","type":"delay","z":"9245b569.9f881","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":510,"y":300,"wires":[["29342d7e.cb24ba"]]},{"id":"3c581622.355d3a","type":"while-loop","z":"9245b569.9f881","name":"","condi":"msg.count <= 1","x":520,"y":520,"wires":[["637d7415.3e256c"],["80540ca2.94228"]]},{"id":"4eaa3847.728c88","type":"debug","z":"9245b569.9f881","name":"Counter 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"count","targetType":"msg","x":910,"y":520,"wires":[]},{"id":"5b1a2de.3b79354","type":"delay","z":"9245b569.9f881","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":510,"y":460,"wires":[["3c581622.355d3a"]]},{"id":"80540ca2.94228","type":"debug","z":"9245b569.9f881","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":900,"y":570,"wires":[]},{"id":"a37c47f0.d5982","type":"ui_group","z":"","name":"Home","tab":"c5a1d7ad.7858","order":1,"disp":true,"width":"6","collapse":false},{"id":"c5a1d7ad.7858","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]