could it be that some opcua tags dont get the "opc...
# umh-support
d
could it be that some opcua tags dont get the "opcua_path" meta in benthos?
this benthos config gives 14 empty opcua_paths:
Copy code
input:
  opcua:
    endpoint: 'opc.tcp://192.168.2.101:4840'
    nodeIDs: 
      - 'ns=3;s="DB_00CommunicationDayResults"'
      - 'ns=3;s="DB_00CommunicationMachineStatus"'
    subscribeEnabled: true

pipeline:
  processors:
    - bloblang: |
        meta folder = if meta("opcua_path").contains("DB_00CommunicationDayResults") {
          "DayResults"
        } else if meta("opcua_path").contains("DB_00CommunicationMachineStatus") {
          "MachineStatus"
        } else {
          "unknown"
        }

        root = {
          meta("opcua_path"): this,
          "timestamp_ms": (timestamp_unix_nano() / 1000000).floor(),
        }

output:
  mqtt:
    urls:
      - tcp://192.168.2.31:1883
    topic: 'umh/v1/TLT/Muzzroom/Meulebekestraat/ProductionLine1/SortingUnit1/originID/_historian/${!meta("folder")}/${!meta("opcua_tag_group")}/${!meta("opcua_tag_name")}'
    client_id: 'benthos-umh'
the null folder are (if i understand correctly) tags without opcua_path meta
what could i be doing wrong?
j
I would say this is quite unlikely, here is the relevant source file: https://github.com/united-manufacturing-hub/benthos-umh/blob/master/opcua_plugin/read.go but I also cannot explain the null, @Ferdinand ?
f
The null must be the opcua_tag_group, as DayResults is the folder here
d
to be honest i have given up on it :p i just put them in a long unstructered folder now
still curious for the solution tho
f
What you could do is something like this:
Copy code
let tag_group =  "/" + meta("opcua_tag_group").or("")
let tag_group = $tag_group.trim.trim_suffix("/") # This will make the string empty if opcua_tag_group is not set
meta "tag_group" = $tag_group
And then use
${!meta("tag_group")}
instead of
/${!meta("opcua_tag_group")}
that should automatically create the tag group if existing
d
would it be beneficial with a custom processor for opcua tags to simplify it? to have like prefixBefore: "mySpecialSuperTurboMachine" prefixAfter: "ordinaryMachine" groupUnknownsTo: "thisIsMyUnknownTags" and so on? in my case i do some renaming of all the tags and i also combine them to a large json. this could be easier handled in a custom processor with some sanity check etc.
d
i think that's a good idea! 🙂
could be nice :p
d
i would have use for it my self so i could perhaps start to write a plugin, but i will see what time i have, i also need to do a new helmchart for chirpstack for our umh migration and i was hoping to have some time to look into a dashboard framework, but i feel the dashboard could take i while so i might do the other stuff first.