Hi there,
I want to combine the different outputs from OPCUA client into 1 JSON object, to be published to MQTT.
This is how the flow looks like:
And the output from the client looks like this:
So, my plan was to filter out the different messages by the topic, and combine the payload into 1 JSON object. The topic is the same as the opcua-string.
Any ideas for how this can be done? Hopefully within one function node.
Thanks in advance
jbudd
19 January 2024 23:34
2
Garrian:
So, my plan was to filter out the different messages by the topic, and combine the payload into 1 JSON object. The topic is the same as the opcua-string.
Any ideas for how this can be done? Hopefully within one function node.
That's what the join node is for.
1 Like
Wow, that was almost too perfect, thanks
Any easy way to remove this part of the string/name?
Function node before the join...
msg.topic = msg.topic.replace('ns=4;s=|var|HetlelidAuto.Application.0PCUA.','')
return msg
(Likely a typo in what I wrote but you did post a picture instead of text! ,
@Steve-Mcl answer is correct short, simple and easy
I would use https://flows.nodered.org/node/node-red-contrib-string for this if there is any chance that,
ns=4;s=|var|HetlelidAuto.Application.0PCUA.
could change in the future.
system
Closed
20 March 2024 02:40
6
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.