Hi,
I am at the beginning of the learning curve how to configure Telegraf for my needs. Till now I have successfully configured to receive MQTT datas from my wallbox for normal values. But the box also publish some datas combined in a JSON String.
Within the MQTT Explorer the String looks like this:
The Value of the JSON-String for the config topic is as follows:
{“average_consumption”: 18000, “charge_template”: 1, “chargemode”: “pv_charging”, “current_plan”: null, “ev_template”: 1, “priority”: false, “time_charging_in_use”: false}
How can I extract for example the chargemode value?
My telegraf.conf:
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = "0s"
debug = false
logtarget = "file"
logfile = "/var/log/telegraf/telegraf.log"
hostname = ""
omit_hostname = false
###############################################################################
# OUTPUT PLUGINS #
###############################################################################
[[outputs.influxdb]]
urls = ["http://127.0.0.1:8086"]
database = "telegraf"
###############################################################################
# SERVICE INPUT PLUGINS #
###############################################################################
# # Read metrics from MQTT topic(s)
[[inputs.mqtt_consumer]]
servers = ["tcp://10.10.20.12:1883"]
#
# ## Topics that will be subscribed to.
topics = [
"openWB/chargepoint/get/#",
"openWB/chargepoint/1/get/#",
"openWB/vehicle/2/get/#",
]
client_id = "TelegrafOpenWB"
data_format = "value"
# data_type = "float"
data_type = "string"
#
# ## Enable extracting tag values from MQTT topics
# ## _ denotes an ignored entry in the topic path
[[inputs.mqtt_consumer.topic_parsing]]
topic = "openWB/chargepoint/1/get/+"
measurement = "chargemode"
# # tags = ""
# # fields = ""
# ## Value supported is int, float, unit
# # [[inputs.mqtt_consumer.topic.types]]
# # key = type
Which is not working for me. I receive all the topics and values but I can not separate all the informations from the JSON-Sttring.
Regards Chris