Join Data by msg.payload.time


I was wondering if i can join 2 Sensordata streams by a message payload.

so if i get for example from sensor 1:
{"time": "09:44:34", "whatever1":123....}
and from the second sensor 2:
{"time": "09:44:34", "whatever2":343....}

and then combine them (by msg.payload.time):
{"time": "09:44:34", "whatever1":123,"whatever2":343....}

The msg.payload.time is a string....
and the thing is, that the data doesnt come exactly at the same moment and sometimes a timevalue is missed....

does anyone hava an idea? Maybe with the join node?

Thanks in advance!

The join node in "manual" mode uses some property of the messages to distinguish one stream from another.

Most often that would be msg.topic.

Perhaps you already have different topics in the incoming messages, otherwise you can use change nodes to set msg.topic to "sensor1" or "sensor2"

Not sure how you would handle missed time slots though.

alright thank you. but is there a way to just join them to the "time" value?
So if the time of Sensor1 equals to time of Sensor2, pass them.
And if they dont equal continue checking after 2 seconds

The Join node has an option to send the joined message after a timeout following the first message. That may be what you want. Then after the join you can look at the contents and decide what to do with the data.

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