Splitting data advice

Hello,

I am receiving some data from an aqara temperature sensor and I really want to extract just the temperature data to send to my blynk app. Here's what I have setup...

Here's the code from the json node... kindly supplied by a person on another forum.

[{"id":"f91c0961d1a8d7db","type":"inject","z":"14ca354715bc92f3","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"battery\":100,\"humidity\":56.09,\"linkquality\":111,\"pressure\":1040,\"temperature\":21.35,\"voltage\":3065}","payloadType":"str","x":230,"y":640,"wires":[["b1664fd5d8d9d187"]]},{"id":"ed0a70bcd258ea58","type":"debug","z":"14ca354715bc92f3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":550,"y":640,"wires":[]},{"id":"b1664fd5d8d9d187","type":"json","z":"14ca354715bc92f3","name":"","property":"payload","action":"","pretty":false,"x":400,"y":640,"wires":[["ed0a70bcd258ea58"]]}]

And here's the output from the json code...

jsonoutput

So all I need to do now is extract the temperature: value so I can send it to my blynk app.

Any advice appreciated.

You do not need the json node. You can set the mqtt node to output a json object.
The documentation has information on how you can move and set message properties using change, function and template nodes here.
https://nodered.org/docs/user-guide/messages

Hi E1cid, thanks for guiding me to that info, much appreciated. I will watch the videos and read the info. I figure all I need to do is add a switch, and then redirect the temperature data.

I've added a switch, see below...

And configured it this way...
PayloadSwitchConfig

Will see if that sends any data, but so far haven't seen anything.

How are you sending messages to the "blynk app", i assume you use a specific node for this ?

The switch node is used to "route" messages to different paths depending on their properties. This is different from your needs: you want to extract a value, you can use a change node for this.

This depends on the output destination (your blynk node) - read the documentation for that node about the input it accepts.

As said the json node is not required.
the switch will direct/filter messages down different routes
the change node moves/sets and changes msg properties

have a look at this example

[{"id":"cf17e5bc.7a6888","type":"inject","z":"c791cbc0.84f648","name":"simulate data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"humidity\":70,\"temerature\":19}","payloadType":"json","x":170,"y":660,"wires":[["84e13593.cc088"]]},{"id":"84e13593.cc088","type":"switch","z":"c791cbc0.84f648","name":"","property":"payload.temperature","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"25","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":360,"y":660,"wires":[["aac72a22.0b5218"],["f775d2e6.87572"]]},{"id":"aac72a22.0b5218","type":"change","z":"c791cbc0.84f648","name":"","rules":[{"t":"move","p":"payload.temperaure","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":640,"wires":[["ff12e9c2.911248"]]},{"id":"f775d2e6.87572","type":"debug","z":"c791cbc0.84f648","name":"other stoff with data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":700,"wires":[]},{"id":"2e754cab.2110b4","type":"mqtt in","z":"c791cbc0.84f648","name":"set to output object","topic":"a/topic","qos":"0","datatype":"json","broker":"d675b749.04b9c8","x":200,"y":720,"wires":[["84e13593.cc088"]]},{"id":"ff12e9c2.911248","type":"debug","z":"c791cbc0.84f648","name":"temp","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":870,"y":620,"wires":[]},{"id":"d675b749.04b9c8","type":"mqtt-broker","name":"Localhost","broker":"localhost","port":"1883","clientid":"","usetls":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Press ctrl I , paste code and click import.

@bakman2 I think you meant Move msg.payload.temperature To msg.payload, or Set msg.payload To the value msg.payload.temperature.

Yes you are correct it was early and still mix it up.

Hi E1cid, that worked really well, thank you so much for your help. I really appreciate the guidance as I am not that up to speed with json code. Thanks again.

@bakman2 thank you for your help, all of this assistance really makes this forum such a great place.