TTN, influxdb, telegraf topic problem

Hello, I’m trying to export the Data from my LDDS-75 to Influxdb via telegraf and MQTT.
Everything is working… “okay” but there is one BIG problem.
The one number I need is not being imported into influx via the MQTT_consumer.
I’m talking about the distance the ultrasonic sensor is measuring.

This is the code I’m using. I assume it’s something with this code but I’m not a professional and I couldn’t figure it out on my own…

The database is hosted on my pi3

Thank you very much in advance!

[[inputs.mqtt_consumer]]
  servers = ["tcp://eu1.cloud.thethings.network:1883"]
  qos = 0
  connection_timeout = "30s"
  topics = [ "v3/deviceID@ttn/devices/+/up" ]
  client_id = "ttn"
  username = "username"
  password = "password"
  data_format = "json"

Screenshot (13)
Screenshot (14)
Screenshot (15)

I have never used your setup before(telegraf, influxdb) but I see that you have 3 decoded fields in your above screen shot: uplink_message_decoded_payload_Bat, uplink_message_decoded_payload_Interrupt_flag, uplink_message_decoded_payload_Sensor_flag. I would assume your ultrasonic reading ought to be there as well. Could there be an issue with your JavaScript decoder thats not decoding your ultrasonic sensor value? Or is the uplink_message_decoded_payload_Sensor_flag parameter the one you are looking for(assuming a binary parameter)?

Thank you for your answer.
I actually found the answer a little before you wrote an answer.

It was a problem with the way ttn decoded the payload.
At the and the distance was printed with “mm”.
This “mm” was the problem. Influx only could handle numbers. So the distance which was printed like this: “1400 mm” could not be imported.
I just changed the payload decoder and now it is working fine.

But thank you for your time!!

1 Like

Or more accurately, there was a problem with the decoder JavaScript - no issues are being reported for the Application Server at this point in time.

1 Like

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