node-red-contrib-match

166 views
Skip to first unread message

Dean Cording

unread,
Feb 24, 2017, 8:14:18 PM2/24/17
to Node-RED
I've noticed a few people using my node-red-contrib-assert node as a message filter.  Whilst it works, it isn't really what it was intended for and would result in many exceptions ending up the debug log.

I created a new node, node-red-contrib-match, that works the same way as node-red-contrib-assert but instead sends matching messages on one output and non-matching messages on a second output.

This works differently to the select node which has multiple single rule outputs; node-red-contrib-match has a single multi rule output.  If you need multiple multi rule outputs, it is easy to just cascade multiple nodes together.


The node is available on npm: https://www.npmjs.com/package/node-red-contrib-match

Enjoy,

Dean

Jon Murphy

unread,
Jun 23, 2017, 8:39:50 PM6/23/17
to Node-RED
Dean - I just tried match (I was about to use assert for a message filter!) and I have two rules.  When it passes both of the rules, I get two of the same message on Output 1.  If it fails, then only one message on output two.  Why two messages when all rules are pass?  Am I doing something wrong?



msg.payload and msg.payload.CurrentSummation are objects.
RasPi 2B with Jessie
nodered is 0.16.2
node is v4.7.3
npm is 2.15.11

Dean Cording

unread,
Jun 25, 2017, 8:54:33 AM6/25/17
to Node-RED
Thanks Jon,

Sorry, my bad - the code never worked as intended but no-one else seemed to have noticed!

I've fixed it now and pushed a new version.

Best if you log issues on GitHub as I don't always read this list.

Dean

Jon Murphy

unread,
Jun 25, 2017, 3:10:50 PM6/25/17
to Node-RED
All works as expected!  Thank you!

Jon
Reply all
Reply to author
Forward
0 new messages