Trigger node - reset ambiguity on what it does

I have recently found a problem when using the trigger node.

If used normally things work as expected.

But if using it to have multiple timers running with different topics sending a reset signal does nothing.

Though I can understand some reasons why it shouldn't clear all active timers, another part of me sees this as a problem.

Flow - for the sake of it.

[{"id":"f590dc16c5aa0177","type":"trigger","z":"26262ba1.62dcbc","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"250","extend":false,"overrideDelay":true,"units":"ms","reset":"","bytopic":"topic","topic":"topic","outputs":1,"x":3900,"y":6320,"wires":[[]]},{"id":"3abdb00e854c6371","type":"inject","z":"26262ba1.62dcbc","name":"Can NOT reset","props":[{"p":"payload"},{"p":"delay","v":"20000","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"topic","payload":"foo","payloadType":"str","x":3720,"y":6320,"wires":[["f590dc16c5aa0177"]]},{"id":"56480dde8153495e","type":"inject","z":"26262ba1.62dcbc","name":"reset","props":[{"p":"reset","v":"reset","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":3710,"y":6270,"wires":[["f590dc16c5aa0177"]]},{"id":"9ae784ad56707ebd","type":"inject","z":"26262ba1.62dcbc","name":"reset","props":[{"p":"reset","v":"reset","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":3710,"y":6370,"wires":[["7ae631ad1aa4f971"]]},{"id":"7ae631ad1aa4f971","type":"trigger","z":"26262ba1.62dcbc","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"250","extend":false,"overrideDelay":true,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":3900,"y":6420,"wires":[[]]},{"id":"dd6953b24c6d4da0","type":"inject","z":"26262ba1.62dcbc","name":"CAN reset","props":[{"p":"payload"},{"p":"delay","v":"20000","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"topic","payload":"foo","payloadType":"str","x":3700,"y":6420,"wires":[["7ae631ad1aa4f971"]]},{"id":"aa5bbbebebbfa787","type":"comment","z":"26262ba1.62dcbc","name":"Start","info":"","x":3550,"y":6320,"wires":[]},{"id":"2dac4b8b7e447eeb","type":"comment","z":"26262ba1.62dcbc","name":"Start","info":"","x":3550,"y":6420,"wires":[]}]

Suggestion/s:

reset is ambiguous as documented.

reset
    If a message is received with this property, any timeout or repeat currently in progress will be cleared and no message triggered.

ANY is the problem word here.
Though different to ALL, it is confusing.

if msg.reset is set, then ALL timers will be stopped.
the if msg.payload == part needs more explaining and should also explain that the topic needs to be set for the desird timer to be stopped/dropped also.

Another thing I noticed:

the if msg.paylad equals
I don't think it works.

Reason:

I had this code:

let msg1 = {}
msg1.topic = msg.payload.name
msg1.payload = "reset"
return msg1

being sent to the trigger node set as shown:

Didn't work.

I had to change it to:

let msg1 = {}
msg1.topic = msg.payload.name
msg1.reset = "reset"
return msg1

and then it worked.

:frowning:

I think the behavior is consistent with bytopic, but the docs could definitely be clearer.

When the Trigger node is set to by topic, each topic gets its own timer state. In that mode, a reset without the matching msg.topic is not really resetting the timer you started earlier, it is just another message arriving without enough context to identify which timer should be cleared.

So the practical rule is:

  • bytopic = all -> one shared timer, reset is straightforward
  • bytopic = topic -> one timer per topic, reset needs the same topic value if you want to clear that specific timer

Your second point also matches what I have seen. If you want to use the dedicated reset behavior, setting msg.reset is the reliable path. Sending payload = reset only works if the node is explicitly configured to reset on that payload value. Those are two different mechanisms, and the current wording makes them sound more interchangeable than they really are.

So I would read this as more of a documentation gap than a runtime bug:

  1. clarify that by-topic timers require the matching topic on reset
  2. separate msg.reset from payload-based reset in the docs
  3. avoid using any when the real behavior is topic-scoped once bytopic is enabled
1 Like