Trigger node - unexpected behaviour with "then send" "the original msg object"

Hello,

Using this simple example, I have data being overwritten of "the original msg object" with a second message, for data outside of payload.

This is unexpected because it states "the original msg object", but it appears to be the payload object.

[{"id":"f818ef9d97ea4587","type":"trigger","z":"af0e2b745f4645fb","name":"wait","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":2470,"y":3720,"wires":[["752455121767ecb5"]]},{"id":"4b2bbf6c985255c3","type":"inject","z":"af0e2b745f4645fb","name":"","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"str"},{"p":"data","v":"special_data_for_flow","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"original_msg","payloadType":"str","x":2270,"y":3680,"wires":[["f818ef9d97ea4587"]]},{"id":"910d95049d21f496","type":"inject","z":"af0e2b745f4645fb","name":"","props":[{"p":"payload"},{"p":"delay","v":"5000","vt":"str"},{"p":"data","v":"delay_reduced","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"second_msg","payloadType":"str","x":2270,"y":3760,"wires":[["f818ef9d97ea4587"]]},{"id":"752455121767ecb5","type":"debug","z":"af0e2b745f4645fb","name":"debug 363","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2630,"y":3720,"wires":[]}]

Yeah, it is confusing. I think the option should be changed to say it is returning the original msg payload. @dceejay any thoughts? I'll do the PR if you think the wording should be changed.

That's not right!

If "extend delay..." is not ticked then it does send the original object.

It it is ticked it sends a hybrid object. The original payload and mixed elements of the first and second messages.

Sorry, the debug messages in this example came out in the reverse order from what I expected.

I tested four combinations:

  1. msg structure (payload, delay and data) different data and 'extend delay on'
  2. msg structure (payload, delay and data) different data and 'extend delay off'
  3. msg structure (payload, delay, data and first or second) different data and 'extend delay on'
  4. msg structure (payload, delay, data and first or second) different data and 'extend delay off'

case 1 and 2 msgs:
Screenshot 2023-02-16 at 11.54.27 AM

case 1 result:
Screenshot 2023-02-16 at 11.56.02 AM
here you can see that the output of the trigger node has msg.payload from the first msg and the rest of the msg is from the second msg.

case 2 result:
Screenshot 2023-02-16 at 11.56.13 AM
here you can see that the output of the trigger node is the data the first msg

case 3 and 4 msgs:
Screenshot 2023-02-16 at 12.15.14 PM

case 3 result:
Screenshot 2023-02-16 at 12.16.49 PM
Here again you can see that only the payload comes from the first msg

case 4 result:
Screenshot 2023-02-16 at 12.04.12 PM
and here again you can see that this is all from the first msg

Conclusion - If Extend delay is on, the second msg is sent with the payload from the first msg.

Here is the flow if you want to see yourself

[{"id":"3789b84d0eafb22a","type":"tab","label":"\"Extend delay\" test","disabled":false,"info":"","env":[],"_mcu":{"mcu":false}},{"id":"f818ef9d97ea4587","type":"trigger","z":"3789b84d0eafb22a","name":"extend delay on","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"3","extend":true,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"_mcu":{"mcu":false},"x":380,"y":160,"wires":[["752455121767ecb5"]]},{"id":"752455121767ecb5","type":"debug","z":"3789b84d0eafb22a","name":"same msg - delay on","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","_mcu":{"mcu":false},"x":620,"y":160,"wires":[]},{"id":"2102e04e2e0d0561","type":"debug","z":"3789b84d0eafb22a","name":"first msg parts same diff content","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","_mcu":{"mcu":false},"x":430,"y":120,"wires":[]},{"id":"8d2f9e925b836029","type":"debug","z":"3789b84d0eafb22a","name":"second msg parts same diff content","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","_mcu":{"mcu":false},"x":450,"y":240,"wires":[]},{"id":"ea08c63f09100ca5","type":"trigger","z":"3789b84d0eafb22a","name":"extended delay off","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"3","extend":false,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"_mcu":{"mcu":false},"x":390,"y":200,"wires":[["ea322209d5de4bb0"]]},{"id":"ea322209d5de4bb0","type":"debug","z":"3789b84d0eafb22a","name":"same msg - delay off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","_mcu":{"mcu":false},"x":620,"y":200,"wires":[]},{"id":"3843e4ac32474fc6","type":"inject","z":"3789b84d0eafb22a","name":"","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"str"},{"p":"data","v":"special_data_for_flow","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"original_msg","payloadType":"str","_mcu":{"mcu":false},"x":150,"y":160,"wires":[["f818ef9d97ea4587","2102e04e2e0d0561","ea08c63f09100ca5"]]},{"id":"a3d5e2e9e2cd7278","type":"inject","z":"3789b84d0eafb22a","name":"","props":[{"p":"payload"},{"p":"delay","v":"5000","vt":"str"},{"p":"data","v":"delay_reduced","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"second_msg","payloadType":"str","_mcu":{"mcu":false},"x":150,"y":200,"wires":[["f818ef9d97ea4587","8d2f9e925b836029","ea08c63f09100ca5"]]},{"id":"6f05288e13b2d80c","type":"comment","z":"3789b84d0eafb22a","name":"The injects have different msg parts","info":"","_mcu":{"mcu":false},"x":200,"y":340,"wires":[]},{"id":"91af1d89b3efc924","type":"comment","z":"3789b84d0eafb22a","name":"The injects have the same msg parts","info":"","_mcu":{"mcu":false},"x":220,"y":40,"wires":[]},{"id":"83c95bf835bbe623","type":"trigger","z":"3789b84d0eafb22a","name":"extended delay off","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"3","extend":false,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"_mcu":{"mcu":false},"x":390,"y":420,"wires":[["3c0d1f8d78036980"]]},{"id":"9a2b52bc92379630","type":"inject","z":"3789b84d0eafb22a","name":"","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"str"},{"p":"data","v":"special_data_for_flow","vt":"str"},{"p":"first","v":"only in first msg","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"original_msg","payloadType":"str","_mcu":{"mcu":false},"x":150,"y":420,"wires":[["83c95bf835bbe623","47d866e599c5438a","56f43b85f515a63d"]]},{"id":"54dbc0708b406f58","type":"inject","z":"3789b84d0eafb22a","name":"","props":[{"p":"payload"},{"p":"delay","v":"5000","vt":"str"},{"p":"data","v":"delay_reduced","vt":"str"},{"p":"second","v":"only in second msg","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"second_msg","payloadType":"str","_mcu":{"mcu":false},"x":150,"y":460,"wires":[["83c95bf835bbe623","cde1074f2fd6f82f","56f43b85f515a63d"]]},{"id":"3c0d1f8d78036980","type":"debug","z":"3789b84d0eafb22a","name":"different msg - delay off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","_mcu":{"mcu":false},"x":630,"y":420,"wires":[]},{"id":"47d866e599c5438a","type":"debug","z":"3789b84d0eafb22a","name":"first msg parts diff + diff content","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","_mcu":{"mcu":false},"x":430,"y":380,"wires":[]},{"id":"cde1074f2fd6f82f","type":"debug","z":"3789b84d0eafb22a","name":"second msg parts diff + diff content","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","_mcu":{"mcu":false},"x":440,"y":500,"wires":[]},{"id":"56f43b85f515a63d","type":"trigger","z":"3789b84d0eafb22a","name":"Extended delay on","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"3","extend":true,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"_mcu":{"mcu":false},"x":390,"y":460,"wires":[["0c93699c0c24ca2f"]]},{"id":"0c93699c0c24ca2f","type":"debug","z":"3789b84d0eafb22a","name":"different msg - delay on","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","_mcu":{"mcu":false},"x":630,"y":460,"wires":[]}]

Of course you are right. I can't explain how I managed to misread those AAA1 and AAA2 etc before.

I seem to think there may have been changes to this area over time ( but I may be wrong). Certainly the original intention was for original msg to mean just that. Not a blend. So needs thinking about as to what the correct fix should be. Ie just the words or the actual behaviour.

1 Like

Personally I have relied on getting a complete original msg so I vote for option 2 (actual behaviour).

I never twigged why I was getting odd results and in the end I changed it to send 'the latest msg object'

I agree. My original comment was based on the way it was working and that a change in the document is easy to do :grin:

I wonder if there are any flows coded to work as is that might break if it changes….

Another option would be to do both, rename "the original msg object" to its current behavior and then add a new option for the expected behavior of "the original msg object"?