MQTT Payload filter?

My "mqtt in" node receives the following data as "a parsed JSON object"

{"topic":"ergebnis","payload":{"00:ff:9d:4b:20:4a":-92,"1a:a8:bb:d2:10:52":-89,"42:2f:c7:89:75:07":-74,"47:73:dd:2c:e7:d0":-89,"f4:fa:fd:7b:b8:dc":-93},"qos":0,"retain":false,"_msgid":"e1557ea7.a105f"}

an example:
MAC Adress: 00:ff:9d:4b:20:4a
signal strength -92

I would now like to check whether a MAC address is available and if so, its signal strength is then output.

Can someone tell me how to configure the nodes?

Thank you and have a healthy week...

[{"id":"42d3b500.ac75dc","type":"mqtt in","z":"7492fcf7.7b3014","name":"mqtt BLE Scan","topic":"ergebnis","qos":"0","datatype":"json","broker":"c6a4e385.5b2c4","x":340,"y":420,"wires":[["64992ea6.4c62","13a52c6c.cba4e4","c021516e.7aaf2"]]},{"id":"c6a4e385.5b2c4","type":"mqtt-broker","name":"mqttbroker","broker":"xxx.xxx.xxx.xx","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Do you control how the data is sent? i.e. could you reformat it?

My solution would be to change the object to an array of objects, eg; {"mac":"xxxx","signal":xx} using jsonata and from there you can filter using a function node or with jsonata.

You could try this flow (check the nodes)

[{"id":"c69460b2.120c38","type":"inject","z":"8dcd4a50.e8563","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"00:ff:9d:4b:20:4a\":-92,\"1a:a8:bb:d2:10:52\":-89,\"42:2f:c7:89:75:07\":-74,\"47:73:dd:2c:e7:d0\":-89,\"f4:fa:fd:7b:b8:dc\":-93}","payloadType":"json","x":194,"y":168,"wires":[["4f3521f3.530858"]]},{"id":"4f3521f3.530858","type":"change","z":"8dcd4a50.e8563","name":"set array of objects","rules":[{"t":"set","p":"payload","pt":"msg","to":"$each(payload.$, function($v, $k) {     {\"mac\":$k,\"signal\":$v} })","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":354,"y":168,"wires":[["b0188e23.78d0d8"]]},{"id":"3bc5f239.d71d16","type":"debug","z":"8dcd4a50.e8563","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"signal","targetType":"msg","statusVal":"","statusType":"auto","x":694,"y":168,"wires":[]},{"id":"b0188e23.78d0d8","type":"change","z":"8dcd4a50.e8563","name":"get signal","rules":[{"t":"set","p":"signal","pt":"msg","to":"*[mac=\"00:ff:9d:4b:20:4a\"].signal","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":168,"wires":[["3bc5f239.d71d16"]]}]

Use a split node to create topic/payload messages & a switch node to re-direct them according to MAC...

[{"id":"593216b7.d6d248","type":"inject","z":"84634390.8f4c4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"00:ff:9d:4b:20:4a\":-92,\"1a:a8:bb:d2:10:52\":-89,\"42:2f:c7:89:75:07\":-74,\"47:73:dd:2c:e7:d0\":-89,\"f4:fa:fd:7b:b8:dc\":-93}","payloadType":"json","x":190,"y":440,"wires":[["baa3743c.d2f258"]]},{"id":"eb234dd.f9905b","type":"switch","z":"84634390.8f4c4","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"00:ff:9d:4b:20:4a","vt":"str"},{"t":"eq","v":"1a:a8:bb:d2:10:52","vt":"str"},{"t":"eq","v":"42:2f:c7:89:75:07","vt":"str"},{"t":"eq","v":"47:73:dd:2c:e7:d0","vt":"str"},{"t":"eq","v":"f4:fa:fd:7b:b8:dc","vt":"str"}],"checkall":"false","repair":false,"outputs":5,"x":490,"y":440,"wires":[["b7ff394e.4bc4f8"],["b62aac2f.1fdeb"],["2f32c44e.edda0c"],["86db3114.65903"],["74371da6.7339e4"]]},{"id":"baa3743c.d2f258","type":"split","z":"84634390.8f4c4","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":350,"y":440,"wires":[["eb234dd.f9905b"]]},{"id":"b7ff394e.4bc4f8","type":"debug","z":"84634390.8f4c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":320,"wires":[]},{"id":"b62aac2f.1fdeb","type":"debug","z":"84634390.8f4c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":380,"wires":[]},{"id":"2f32c44e.edda0c","type":"debug","z":"84634390.8f4c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":440,"wires":[]},{"id":"86db3114.65903","type":"debug","z":"84634390.8f4c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":500,"wires":[]},{"id":"74371da6.7339e4","type":"debug","z":"84634390.8f4c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":560,"wires":[]}]

Hello,

I didn't know "jsonata" before, but it works very well!

Thank you for your help

Hello,

I haven't used the "spilt node" yet.
That works for me too!

Thanks for your help

Hallo,
I have no further question: How do I have to configure the "Split Node" so that the signal is not displayed, but the MAC addresses ?

Danke,

What do you mean? the split node does not display anything.

You can change the DEBUG nodes to show msg.topic

Hello,

I think the "split node" will do the payload so the signal strength will be, right?
But I also want to see the MAC addresses from the payload. Is that possible?