Send Message only if it is the Same as before

Hello,

i would like to forward a Massage to the next Node, but only if the Message is the Same Message as befor.

Best Regards,
Tobias

What qualifies the message as being the same? The contents of payload? The string in topic? Both? All properties of msg?

A simple way would be to use a function node, get/set last value in node context, if same, return msg if different, return null

Note, once node context is set, you can only ever get that same message through forever more. Seems like an odd request?

1 Like

You need the opposite of the RBE node (report by equality?). As @Steve-Mcl said, using node context is the way to go in a function node. Give it a try, you will learn a lot about the workings of node red. If you get stuck just ask!

Right, the switch node is the way to go...you will achieve your goal without a single line of coding :slight_smile:

Screenshot%20at%202019-06-23%2020-03-01

3 Likes

Ah, of course. Brilliant!

Thanks, i will try this.

That only works if you want msg.payload to be the same as before.

As @Steve-Mcl already suggested it depends on if you just want msg.payload to be the same or the entire message as you initially stated

msg.payload is fine, so the switch Node Methode should work. Will try when i get Home.

The entire message will always be different because of the _msgid.

Of course, I/we did mean all properties that the user added to the message i.e. more than just payload. :smile:

2 Likes

<pedantic_mode_off> :slight_smile:

1 Like