Repeat node not working correctly


#1

repeat node not working correctly doesnt awitch to ELSE output after message passed 3 times
.
.
the node:.


my code:

 [{"id":"cda5a735.9bf3a8","type":"delay","z":"e4d8382f.f4813","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1720,"y":1460,"wires":[["cc1497c7.71a8b"]]},{"id":"3804f703.e84b48","type":"inject","z":"e4d8382f.f4813","name":"test","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1716,"y":1337,"wires":[["c3b110d0.7cce4"]]},{"id":"cc1497c7.71a8b","type":"delay","z":"e4d8382f.f4813","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1723,"y":1520,"wires":[["1571bb17.744cb5"]]},{"id":"1571bb17.744cb5","type":"delay","z":"e4d8382f.f4813","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1722,"y":1581,"wires":[["14559f5a.9fe351"]]},{"id":"14559f5a.9fe351","type":"delay","z":"e4d8382f.f4813","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1721,"y":1633,"wires":[["735f2110.6e7eb"]]},{"id":"735f2110.6e7eb","type":"delay","z":"e4d8382f.f4813","name":"Kenteken wisselen 10 seconde","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1794,"y":1707,"wires":[["cf078ebb.ac14f8"]]},{"id":"cf078ebb.ac14f8","type":"repeat","z":"e4d8382f.f4813","name":"","repetitions":"3","elseOutput":true,"outputs":2,"x":1744,"y":1747,"wires":[["c3b110d0.7cce4"],["87a5150e.56c37"]]},{"id":"c3b110d0.7cce4","type":"ui_button","z":"e4d8382f.f4813","name":"Normaal inrijden","group":"1c37e01a.713448","order":2,"width":"6","height":"1","passthru":true,"label":"Normaal inrijden","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":1916,"y":1337,"wires":[["f26e058f.29eed8","da268118.201098"]]},{"id":"9b6666c4.c46e3","type":"gate","z":"e4d8382f.f4813","name":"gate","controlTopic":"control","defaultState":"closed","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":1856,"y":1417,"wires":[["cda5a735.9bf3a8"]]},{"id":"437d3303.4dfc94","type":"rpi-gpio in","z":"e4d8382f.f4813","name":"","pin":"16","intype":"tri","debounce":"25","read":false,"x":1576,"y":1417,"wires":[["45df1a9d.bd0df4"]]},{"id":"45df1a9d.bd0df4","type":"switch","z":"e4d8382f.f4813","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1716,"y":1417,"wires":[["9b6666c4.c46e3"]]},{"id":"87a5150e.56c37","type":"change","z":"e4d8382f.f4813","name":"Reset","rules":[{"t":"set","p":"payload","pt":"msg","to":"default","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1716,"y":1377,"wires":[["9b6666c4.c46e3"]]},{"id":"f26e058f.29eed8","type":"change","z":"e4d8382f.f4813","name":"Open","rules":[{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1576,"y":1377,"wires":[["9b6666c4.c46e3"]]},{"id":"3d30eae.c762416","type":"inject","z":"e4d8382f.f4813","name":"test Pin","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1556,"y":1457,"wires":[[]]},{"id":"da268118.201098","type":"ui_text","z":"e4d8382f.f4813","group":"defe4730.2123f8","order":0,"width":0,"height":0,"name":"","label":"output to trigger pin 16","format":"{{msg.payload}}","layout":"row-spread","x":2200,"y":1340,"wires":[]},{"id":"1c37e01a.713448","type":"ui_group","z":"","name":"dubbele In/Uit","tab":"13f7e980.24574f","order":1,"disp":true,"width":"6","collapse":false},{"id":"defe4730.2123f8","type":"ui_group","z":"e4d8382f.f4813","name":"Click","tab":"","order":1,"disp":true,"width":"5"},{"id":"13f7e980.24574f","type":"ui_tab","z":"","name":"Slagboom Sim","icon":"dashboard"}]

thanks in advance,

.
Ivar


#2

If the node is not working correctly, wouldn't it be better for you to raise an issue with the node author?


#3

I thought, maybe someone here would know the answer
and maybe it is working correctly, that im doing it wrong


#4

@IvarMvl

This node hasn't been updated for more than 3 years.
But it's a simple node, so you need to count the number of msgs until 3 and get an output?
Maybe I can post another solution.


#5

so when you put the node in a closed loop it loops 3 times through the fist output and the fouth time its meant to send the message to a second output out of the same node so it can break off


#6

Do you need the first output? it seems to me that it's only used for the _loopController.


#7

this is what the node help said

.
Allow a message to pass through this node for an specific number of times, after which it will be discarded, unveiling the ability to limit the loops over a flow to N times.

If Else Output is activated, a second output is enabled that will receive the message once when the repetitions have been exhausted


#8

A simple function (set Outputs to 2) to replace the repeat node (not really sure it's what you need)

var count = context.get('count') || 0;
var msg2 = {};

if (count < 3) {
    count++;
    msg2 = null;
} else {
    count = 0;
    msg2 = msg;
    msg = null;
}

context.set('count', count);

return [msg, msg2];

#9

exactely what I needed thank you.