Hi guys, I have to filter false payloads out. I'd like to have the payload values at the output If the payload value did not change over a period of time, e.g. on a 100 ms period or longer, otherwise nothing at the output, Can you please let me know how?
You will need to use multiple nodes. there a various ways.
here is an example the use a join node set to timeout after 100ms, the switch node then determines if the distinct count is 1, and passes the msg if so. The change node just returns the first unchanged message within timeout.
eg.
[{"id":"a0958109.bf19d","type":"inject","z":"c791cbc0.84f648","name":"single message","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":230,"y":1840,"wires":[["9ec224a5.5fef9"]]},{"id":"9ec224a5.5fef9","type":"join","z":"c791cbc0.84f648","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"0.1","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":530,"y":1900,"wires":[["e34b6332.fcae08"]]},{"id":"e34b6332.fcae08","type":"switch","z":"c791cbc0.84f648","name":"","property":"$count($distinct(payload))","propertyType":"jsonata","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":660,"y":1900,"wires":[["c90747bf.ad5b18"]]},{"id":"f4e7bdc1.853ad8","type":"trigger","z":"c791cbc0.84f648","name":"","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"50","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":200,"y":2020,"wires":[["9ec224a5.5fef9"]]},{"id":"d952d96d.4b965","type":"trigger","z":"c791cbc0.84f648","name":"","op1":"true","op2":"true","op1type":"bool","op2type":"bool","duration":"50","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":200,"y":1920,"wires":[["9ec224a5.5fef9"]]},{"id":"c90747bf.ad5b18","type":"change","z":"c791cbc0.84f648","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":1900,"wires":[["2502e681.e4e682"]]},{"id":"53fc6dc.ec49f14","type":"inject","z":"c791cbc0.84f648","name":"two different messages","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":210,"y":1980,"wires":[["f4e7bdc1.853ad8"]]},{"id":"b7212981.b88128","type":"inject","z":"c791cbc0.84f648","name":"two messages identical","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":210,"y":1880,"wires":[["d952d96d.4b965"]]},{"id":"2502e681.e4e682","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":1960,"wires":[]}]
Ignore my first post, try this:
[{"id":"e413a61d9480ecbb","type":"tab","label":"Flow 6","disabled":false,"info":"","env":[]},{"id":"e6d0f034ca19ab8b","type":"rbe","z":"e413a61d9480ecbb","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":260,"y":120,"wires":[["6d9b3008a343540a"]]},{"id":"6d9b3008a343540a","type":"trigger","z":"e413a61d9480ecbb","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"100","extend":true,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":520,"y":120,"wires":[[]]}]
Amazing , Thanks
Thank you, for this and my previous post.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.