jasperlouage
08/06/2025, 2:24 PMjasperlouage
08/06/2025, 2:25 PMJermuk
08/06/2025, 2:26 PMJermuk
08/06/2025, 2:27 PMjasperlouage
08/06/2025, 2:32 PM{
"mappings": [
{
"opc_ua_path": "default.PaintRoom1.CarsPainted",
"sparkplug_name": "paint_booth.cars_painted",
"sparkplug_alias": 102,
"sparkplug_type": "integer",
"writeable": false,
"deadband_time": 15
},
{
"opc_ua_path": "default.PaintRoom1.Spraytan1.Color",
"sparkplug_name": "paint_booth.spray_gun.color",
"sparkplug_alias": 103,
"sparkplug_type": "string",
"writeable": true,
"deadband_time": 15
},
{
"opc_ua_path": "default.PaintRoom1.Spraytan1.Pressure",
"sparkplug_name": "paint_booth.spray_gun.pressure",
"sparkplug_alias": 104,
"sparkplug_type": "integer",
"writeable": false,
"deadband_time": 15
}
]
}
Here is where my issue starts.
When I write my initial messages, the only way to define my aliases is to put them in the Sparkplug B output 'metrics' variable. But this variable does not take my json as input, nor does it accept extra fields. So I am not able to define my alias, and even if I would use it, I would never be able to map the alias back to the OPC UA value, since the mapping is only done in my output...
I see the following solutions:
- Transform my json mapping to yaml, and change the output so that it can also accept extra fields --> Is it possible to ignore extra fields in Benthos? Right now it throws linting errors if I try.
- Change the output metrics, so that it can be a expression, based on a variable in my processors
- Maybe even change the base format for metrics, so you build in that there might be a source-tag-path?
What option sounds most Benthos-like? Or how would any of you approach this issue?
See in attachement my processing of DCMD commands, finding back the tags in the json. It works when it knows the aliases, but I don't want to have 2 definitions of my tags.jasperlouage
08/06/2025, 7:43 PMjasperlouage
08/06/2025, 7:46 PMJermuk
08/07/2025, 10:24 AMJermuk
08/07/2025, 10:56 AMjasperlouage
08/10/2025, 1:47 PMJermuk
08/12/2025, 2:55 PMJermuk
08/20/2025, 8:56 AMcache_resources:
- label: sparkplug_metrics
file: # or redis for distributed setups
directory: /tmp/benthos-cache
output:
sparkplug_b:
mqtt:
urls: ["tcp://mosquitto:1883"]
metric_cache_resource: sparkplug_metrics
So then on startupo, you would preload the sparkplug metrics from the specified cache. I think this could make it more benthos "natural"jasperlouage
08/20/2025, 3:50 PM