Telegraf - Mqtt Consumer

Hi there, I’m reading data from mqttt broker, but having problems with format. When I try to read these values in Grafana I get the following error:

InfluxDB Error: unsupported mean iterator type: *query.stringInterruptIterator

However it does work if I use count instead of mean, so I think it has to do with the data_type not being recognized for aggregation functions.

Topics is published in the following format:

shellies/shellyem-B9FXXX/emeter/0/power

An example of the output from Mqtt Explorer:

Screen Shot 2020-09-14 at 3.46.11 AM

This is the config file that I use in telegraf:

[agent]
  flush_interval = "15s"
  interval = "15s"

[[inputs.mqtt_consumer]]
  name_override = "shelly1"
  servers = ["tcp://192.168.100.132:1883"]
  qos = 2
  connection_timeout = "30s"
  topics = [ "shellies/shellyem-B9FXXX/emeter/0/power" ]
  topic_tag = "power"
  username = "hass"
  password = "xxxxxxxx"
  data_format = "value"
  data_type = "string" 

[[outputs.influxdb]]
  database = "iot"
  urls = [ "http://influxdb:8086" ]
  username = "iotlnu"
  password = "xxxxxxxx"

Thanks in advance for your help!!!

I fix this by changing the data type to float. Now I can do mean operations inside Grafana without getting the error message.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.