Telegraf.conf file for shelly 1pm data

Hello
I would like to store all the data from a Shelly 1PM in a influx database.
So i have difficulties in configure my telegraf.conf file for that purpose.
The Shelly publishing MQTT messages like this …:
Client mosqsub|1204-raspberryp received PUBLISH (d0, q0, r0, m0, ‘shellies/sh1pm/temperature’, … (5 bytes))
34.21
… but unfortunately i do not find any data in my database “shellies” !
The telegraf.conf file looks like this …

[global_tags]

[agent]

  interval = "15s"
  round_interval = true

  metric_batch_size = 1000

  metric_buffer_limit = 10000

  collection_jitter = "0s"


  flush_interval = "10s"

  flush_jitter = "0s"

  precision = ""


#===============================================================================
[[outputs.influxdb]]
 urls = ["http://raspberrypi:8086"]
 database = "shellies"


# ==============================================================================
# # Read metrics from MQTT topic(s)
[[inputs.mqtt_consumer]]
#   ## MQTT broker URLs to be used. The format should be scheme://host:port,
#   ## schema can be tcp, ssl, or ws.
servers = ["tcp://raspberrypi:1883"]
#
#   ## Topics that will be subscribed to.

topics = ["+/+/+"]

data_format = "json"

Can anybody help me?
Thanks

Hi @Toni-PV
To isolate the problem, I’d suggest setting [debug = true] in the [agent] section and sending your output to stdout. Then verify that the JSON coming into Telegraf looks good.

You’re using the 1.X output plugin for Influxdb which is fine if you have installed a 1.X version on the other side. You may need some additional authentication info in [[outputs.influxdb]].

JSON is coming into Telegraf but Influx typically expects Line Protocol.

Hello phill

Many thanks, i could solve the problem with your help.
Debugging showed me, that something is wrong about the output.
So i replaced

data_format = “json”

with

data_format = “value”
data_type = “float”

Now it is working fine

Best regards

2 Likes

@Toni-PV That’s fantastic. Good luck with your project!

@phill thank you for helping!