since my previous post I have set up my own Gateway (Dragino LPS8) and deployed 2 separate clients.
Data is being received on my Gateway and all seems to be OK.
Now my next challenge is visualizing this data in Node-Red.
After first spending too much time on trying to get some depreciated nodes imported into Node-Red (Node-red-contrib-ttn) I switched to using a MQTT node. This was up and running quickly.
Data from one of my clients include battery, temperature and humidity values.
Apparantly it was once possible to filter on fields with the instruction: [AppID]/devices/[DevID]/up/[Field] but due to overhead (?) reasons this has been cancelled and now it is only possible to retrieve the complete payload with the instruction: [AppID]/devices/[DevID]/up
This gives me a lot of output in the debug screen.
Can anybody instruct me how to filter out the fields of interest out of this mess?
I can’t seem to find any examples or info how to do this.
Sorry for my newbie ignorance
The way I do it is by feeding the output of the MQTT node into a JSON node. Then the output of the JSON node goes to a function node which splits the message into field for further processing. An example to split into three streams:
(Don’t forget to set the function node to three outputs, done below the code section)
Using this mechanism you can extract and forward any fields you want to keep for further processing.
There are probably other solutions as well, I’m no Node-Red expert, but this works for me.
Hi @LouThings, I disagree that it’s a “mess”. I think that it’s very highly ordered and structured.
Anyway, if you want to do interactive experiments then you can simply use the mosquitto_sub utility as described in the TTN MQTT documentation to subscribe to an MQTT data stream and then pipe the output into the jq (json query) utility to extract and manipulate specific JSON variables.
The post from @kersing gives a good description of a serious long-term approach.
You are right @cultsdotelecomatgmai.
It is indeed highly ordered and structured, I simply called it a mess as I was overwhelmed by the amount of data that is output. As is so often the case: (my) ignorance gave rise to a misinterpretation.
My apologies are called for.