I have a MODBUS to MQTT datalooger with 2 variables configured. (it will added more variables in the future)
The payload of the MQTT message is like this:
{
"date":"2023-08-25T15:59:40.0Z",
"id":"AAAAAA020000000002301443",
"vars":[
{
"name":"sonda1 > radiacion",
"value":"0.3"
},
{
"name":"sonda1 > Temperatura_celula",
"value":"26.5"
}
]
}
My intention is read the values in telegraf and save it in nfluxdb. How can I parse the response to keep the name of the variable (sonda1 > radiacion and sonda1 > Temperatura_celula) and its values?
Thanks for your time and your help!
My actual config is:
data_format = "json_v2"
[[inputs.mqtt_consumer.json_v2]]
[[inputs.mqtt_consumer.json_v2.object]]
path = "vars"