MQTT in Node - sort/switch the input

Hello
i have some msg.payload coming from a Raspi-with433MHz Dongel.
They nicely drop in Node Red MQTT IN with output a parsed JSON object
The Question how do i splitt the Message to use them and later add to InfluxDB?
The id: will ich change, or how will it work when two device have the same ID?
Do i have to use the Switch node, to splitt the differen input?

iot12-rpi3b-gw-433 : msg.payload : Object
object
time: "2020-12-16 21:31:37"
brand: "OS"
model: "Oregon-THGR122N"
id: 126
channel: 2
battery_ok: 1
temperature_C: 6.2
humidity: 77

have a nice day
vinc

Why do you think you have to split the message up? For example, You could send the msg to three different debug nodes and each one would have all the data. All you need to do is address the item you want like msg.payload.humidity

@zenofmud thanks for your feedback
not the Message itself but the flow of message have to be splitt. i think but not to sure!
have a nice day
vinc

There is no point working out how to do something if you don't even know whether you need to do it. What is it that you need to do?

i have all 433MHz Message coming in with MQTT.
Some device i Know some not.
the one i know i would like to store it in a Database and also send message if Battery is low.
the device i am not sure should just be listed and after a while should be deleted

have a nice day
vinc

@vikozo

  1. What is building the JSON object?
  2. If you have multiple devices with the same 'id' is the 'model' different? Can you change the 'id' on the device?
  3. is the data coming from the different devices different? for example, it one device reporting temperature and humidity while another is reporting if a window is open or closed?

If you have multiple devices sending in the same ID and the MODEL is the same, there is no way to tell which device it came from. That would have to be determined before the data makes it to Node-RED.

Once the data gets to NR, you you could use a switch node to send the msg to different legs of the flow.

@zenofmud Hello Paul
it is called up or send from a Raspberry Pi with 433 Dongel
rtl_433 -F json -M utc | mosquitto_pub -h 192.168.x.xxx -p 1883 -t home/rtl_433 -l

like this all come in!
time : 2020-12-14 22:10:55
model : TFA-Pool Id : 142
Channel : 1 Battery : 1 Temperature: 2.9 C Integrity : CHECKSUM


time : 2020-12-14 22:10:59 brand : OS
model : Oregon-THGR122N House Code: 16
Channel : 1 Battery : 1 Temperature: 23.20 C Humidity : 38 %


time : 2020-12-14 22:10:59 brand : OS
model : Oregon-THGR122N House Code: 126
Channel : 2 Battery : 1 Temperature: 22.70 C Humidity : 52 %

the model is strange because the THGR122N are two different device but send the same Information.

no i can't change the ID - i dont know where it commes from

i would have been thinking
a switch and sort/splitt the device between the known and the other
so switch model : Oregon-THGR122N and then a second switch for the channel or the ID
this both the data should go to a database

the other is just for curiosity what is arround which i could also be added to the known as soon i know where it stay

have a nice day
vinc

Can you put a debug node (set to display the 'Complete msg object) on the output of the mqtt-in node. After it spits out some data, expand all the items in the debug log and copy and past a couple into a reply.

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