Telegraf - Modbus: Data is written as integer instead of float into InfluxDB

Hi,
I’m reading data from a Huawei solar inverter using the modbus plugin from telegraf.
Basically it works, but the data which is written into InfluxDB is witten to it as integer.
In the definition of the registers I’m using scale factors. Based on that I assumed that the data is stored as float.

Here’s the configuration of the plugin. To keep it short there is only one line defining a register. To keep it short I removed all other lines.

[[inputs.modbus]]
   name = "PV Huawei"
   name_override = "PV Huawei"

   slave_id = 1

   timeout = "1s"

   controller = "tcp://192.168.85.178:502"

   configuration_type = "register"
   
   holding_registers = [
     { name = "PV01 voltage" , byte_order = "AB", data_type = "INT16", scale =  0.1, address = [32016] },     
   ]

Am I doing something wrong?
I already completly deleted the measurement “PV Huawei”. But afterwards the values are still written as integer into InfluxDB.

Thanks to all of you!

Ummm you are explicitly specifying that the output should be INT16 using the data_type option with the register config style. What do you expect Telegraf to do? I suggest removing the data_type option and you will get a float… Or even better use the request or metric configuration style as those provide more options on tuning the output type…

Oh,
I thought the data_type option is to define how the data is provided from the device.
I already changed it!

Thank you very much!

1 Like