Condition loop only exits during testing

I realized there is a way to use the current intensity in my flow

Of the 2 nodes available for my lights, one has the capability to only send a value to the lamp, the other has the capability to only receive events from the lamps (a single lamp or all lamps). I can't poll the lamp for it's current value, but I can use the second node to update a variable each time the lamp changes (either through a physical switch, this flow, or any other method), and I can use that variable in the flow to set the initial value, and in the increment function.

Unfortunately, this will never be 100% reliable; if the Node Red server goes out due to a power outage or a shutdown due to an update or maintenance, the value would be out of sync until the next time the light changes. But for my needs, this should be sufficient enough for now.

Now that I have found that i have a way to use the current value of the light, I understand that your first suggested flow using the delay wouldn't work, as the messages would have all been sent before the light changes value.

But this flow should be adaptable to use a variable set from the light changing event, so I'll have to look into this at some time in the future to see if it would be usable. For now, I'm going to use my current flow, as it is easily understandable, but this does give me something to think about.

No extra messages in the debugger this morning, so it looks like the loop exited properly this time. Your assumption that there may be a bug in the node seems possible (although, it's more likely that i may have been using it incorrectly).

Thanks again for your help. Onward to my next Node Red challenge!