Filter by name in payload

Hello, i am new in node red
Node (MQTT IN) is connected to the things network (TTN), ELSYS ERS Eye registered in TTN, HTTP GET request configured to external application works

payload is:

v3/motiondetection@ttn/devices/eui-a81758fffe0654c8/up : msg.payload : string[782]

"{"end_device_ids":{"device_id":"eui-a81758fffe0654c8","application_ids":{"application_id":"motiondetection"},"dev_eui":"A81758FFFE0654C8","join_eui":"0000000000000000"},"correlation_ids":["as:up:01FE39GWYM12QSTX410B86MWR6","rpc:/ttn.lorawan.v3.AppAs/SimulateUplink:43864109-9910-45f8-bb86-ca23804cad76"],"received_at":"2021-08-27T07:52:23.253656996Z","uplink_message":{"f_port":1,"frm_payload":"BQERAQ==","decoded_payload":{"motion":1,"occupancy":1},"rx_metadata":[{"gateway_ids":{"gateway_id":"test"},"rssi":42,"channel_rssi":42,"snr":4.2}],"settings":{"data_rate":{"lora":{"bandwidth":125000,"spreading_factor":7}}},"received_at":"0001-01-01T00:00:00Z","locations":{"user":{"latitude":47.49257222077071,"longitude":8.720179064421783,"source":"SOURCE_REGISTRY"}}},"simulated":true}"

now i will filter exactly and only the value "motion:1" to send it to ext. application
What is the correct configuration for this ?
Thank you very much for feedback.

Set the mqtt node to output an object, then msg.payload.uplink_message.decoded_payload.motion
should hold the value of 1
as in image below


then use copy path in the debug pain to get the path to the info, as in below image

thank you
what object can i take ? change object or function object ?

thank you very much, that looks better now
my topic in MQTT must be #
one more question ; what object can filter exactly value motion 1 to send only message with value motion 1 , at the moment all messages with motion are transmitted. how to configure ?

thats my "dream" it should be looking like that.....

If you do that you will get all mqtt messages, not just the one you want. Set it to the topic you are interested in.

The images you supply do not help as there is no info i can get from them.
You may use any topic you like. The example in the image i supplied is only to show you how to otput an object.
As to the object you would need to use the path to the motion value "1" then create the message you wish to send. I Showed you in image above how to get the path to any value in your incoming object.

If you require more help you will need to supply text or flow json, so any one helping can easily copy info to give you more examples.

here is a simple example how to extract the "1" and create a message that will output "Motion 1", it uses a switch node to only allow the value 1 through

[{"id":"98ed224a.4e929","type":"inject","z":"c74669a0.6a34f8","name":"simulate mqtt in","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"end_device_ids\":{\"device_id\":\"eui-a81758fffe0654c8\",\"application_ids\":{\"application_id\":\"motiondetection\"},\"dev_eui\":\"A81758FFFE0654C8\",\"join_eui\":\"0000000000000000\"},\"correlation_ids\":[\"as:up:01FE39GWYM12QSTX410B86MWR6\",\"rpc:/ttn.lorawan.v3.AppAs/SimulateUplink:43864109-9910-45f8-bb86-ca23804cad76\"],\"received_at\":\"2021-08-27T07:52:23.253656996Z\",\"uplink_message\":{\"f_port\":1,\"frm_payload\":\"BQERAQ==\",\"decoded_payload\":{\"motion\":1,\"occupancy\":1},\"rx_metadata\":[{\"gateway_ids\":{\"gateway_id\":\"test\"},\"rssi\":42,\"channel_rssi\":42,\"snr\":4.2}],\"settings\":{\"data_rate\":{\"lora\":{\"bandwidth\":125000,\"spreading_factor\":7}}},\"received_at\":\"0001-01-01T00:00:00Z\",\"locations\":{\"user\":{\"latitude\":47.49257222077071,\"longitude\":8.720179064421783,\"source\":\"SOURCE_REGISTRY\"}}},\"simulated\":true}","payloadType":"json","x":230,"y":3060,"wires":[["bb5d3d9f.314f1"]]},{"id":"bb5d3d9f.314f1","type":"switch","z":"c74669a0.6a34f8","name":"","property":"msg.payload.uplink_message.decoded_payload.motion","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":3080,"wires":[["b2bd381b.685f98"]]},{"id":"b2bd381b.685f98","type":"change","z":"c74669a0.6a34f8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"Motion \" & $$.msg.payload.uplink_message.decoded_payload.motion","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":3080,"wires":[["f8d76bc5.f3ef18"]]},{"id":"f8d76bc5.f3ef18","type":"debug","z":"c74669a0.6a34f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":700,"y":3040,"wires":[]}]

thank you very very much !
now it works. Filtering only for motion 1 transmitted.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.