Hello community,
after a long time trying to find a solution, I’m asking for help here.
I would like to import all the data sent by a MQTT string into an InfluxDB database. Then visualize the data with Grafana.
This is the MQTT string sent by a shunt:
Topic-01: Shunt/MAC_AA:BB:CC:DD:EE/info
{
"ProductName": "Shunt",
"FirmwareVersion": "v4.0.4.3",
"PID": "0220",
"HWRevision": "0101",
"url": "http://192.168.3.212"
}
Topic-02: Shunt/MAC_AA:BB:CC:DD:EE/data
{
"status": {
"rssi_dBm": -57.00,
"heap_B": 65624.00,
"vdd_V": 3.30,
"CPU_temp_C": 35.70,
"uptime_s": 93310.00,
"ambient_temp_C": 25.34,
"ambient_humidity_RH": 38.05,
"ambient_dewpoint_C": 10.01
},
"live": {
"battery_percentage": 0.00,
"battery_soc_Ah": 0.01,
"battery_voltage": 12.46,
"battery_current": 0.00,
"solar_current": 0.00,
"solar_power": 0.00,
"solar_charge": 0.01,
"pv_voltage": 0.00,
"solar_voltage": 0.00,
"pv_peak_power": 0.00,
"solar_charger_phase": 0,
"booster_current": 0.00,
"booster_charge": 0.00,
"booster_in_voltage": 0.00,
"booster_out_voltage": 0.00,
"aux_voltage": 12.45,
"booster_charger_phase": 0,
"booster_limit_status": 0,
"relais_status": 0,
"solar_type": "undefined",
"booster_type": "undefined",
"booster_temp_internal": null,
"booster_temp_battery": null,
"booster_temp_generator": null,
"solar_Wh": 0.00,
"battery_in_Wh": 0.02,
"battery_out_Wh": 0.04,
"booster_Wh": 0.00,
"land_Wh": 0.02,
"solar_charge_Ah": 0.01,
"battery_charge_Ah": 0.00,
"battery_discharge_Ah": 0.00,
"booster_charge_Ah": 0.00,
"land_charge_Ah": 0.00,
"shunt_C": 24.02,
"shunt_vbus": 12.46
}
}
This is the MQTT configuration that I have created so far, but unfortunately I don’t know what to do next:
[[inputs.mqtt_consumer]]
servers = ["tcp://127.0.0.1:1883"]
topics = ["Shunt/MAC_AA:BB:CC:DD:EE/info"]
data_format = "json_v2"
[[inputs.mqtt_consumer.topic_parsing]]
topic = "+/+/+"
tags = "_/_/_"
measurement = "_/measurement/_"
fields = "_/_/value"
[[inputs.mqtt_consumer.json_v2]]
[[inputs.mqtt_consumer.json_v2.object]]
[[inputs.mqtt_consumer.json_v2.field]]
This is the error starting Telegraf with the -debug option:
[inputs.mqtt_consumer] Connected [tcp://127.0.0.1:1883]
[inputs.mqtt_consumer] No metrics were created from a message. Verify your parser settings. This message is only printed once.
[inputs.mqtt_consumer] Error in plugin: the GJSON path is required
Any help is welcome. Thank you very much!
JooJoo