Relevant telegraf.conf:
[[inputs.modbus]]
holding_registers = [
{ name = "outdoor_temperature", byte_order = "AB", data_type = "FLOAT32", scale=0.1, address = [903]},
]
Related issue: #7266.
The register holds a temperature scaled 10x. I want to store the decimals so I use FLOAT32.
When the temperature outdoors is 5.3° the register holds the int 53, and I want to use scaling to store 5.3.
When the temperature is below 0° the register holds a signed integer representing a negative value.
The problem is when the modbus plugin treats negative values.
Expected behavior:
The modbus plugin should handle negative values as well as positive. When the register holds -13 it should be intepreted as -1.3 after scaling.
Actual behavior:
Negative values are treated as unsigned. With a few negative degrees it stores the float 6554.0.
I see no way around this in telegraf except using the type INT16 instead of FLOAT32 and thus throw away the decimals.
Additional info:
FLOAT32 is handled here. It assumes a UINT16 but INT16 values are also possible.
Relevant telegraf.conf:
Related issue: #7266.
The register holds a temperature scaled 10x. I want to store the decimals so I use FLOAT32.
When the temperature outdoors is 5.3° the register holds the int 53, and I want to use scaling to store 5.3.
When the temperature is below 0° the register holds a signed integer representing a negative value.
The problem is when the modbus plugin treats negative values.
Expected behavior:
The modbus plugin should handle negative values as well as positive. When the register holds -13 it should be intepreted as -1.3 after scaling.
Actual behavior:
Negative values are treated as unsigned. With a few negative degrees it stores the float 6554.0.
I see no way around this in telegraf except using the type INT16 instead of FLOAT32 and thus throw away the decimals.
Additional info:
FLOAT32 is handled here. It assumes a UINT16 but INT16 values are also possible.