Telegraf scale processor

Hi to All,
I’m studying the telegraf documentation to look if it’s the right choice in my case:
I need to collect some data from a ModBus TCP device. I’ve found an input plugin for telegraf that is in development that can import those data, but I haven’t found a way to scale/adapt it, something like a processor that can accept math formulas.
For example I need to convert a temperature read from an 7bit value (0-127) to a 0-100°C value, that is the real temperature that I want to save.
Any way of doing it? There’s any option or plugin for telegraf I’ve missed? Or im case I have to create my own?
Cheers Mix

The plan with the Modbus plugin will be to include some scaling functionality within the plugin itself, using the scale option. If the currently proposed support isn’t enough for your use case, I’d love to hear more about how exactly this conversion is done.

Thanks @daniel for the answer and your work :wink:

Yes, that scale attribute can work for some of my case, but I have some other case that are more complex:
For example I have a temperature sensor that return the measure in 10*K where K in the temperature in Kelvin, and I need to save that in Celsius, so the formula would be something like (IN-2730)*0.1
In this case the 0.1 part can be done with the scale attribute, but I need something like an offset adjust for the read value. (And that would probably be an useful additional parameters, if you would like to include it)

Speaking in general there’s probably some other case that can require a more complex math formula and I think would be great to have a processor that can do that or maybe some approximation.
Thanks again
Cheers Mix

Yeah, I agree that we need a processor for this. We do have an issue open for a math processor, but there are a few other possibilities for how this could be solved: we may introduce an exec processor that can run user scripts, or it could be a job for a flux processor.

Currently though the simplest solution would be to move this operation into the query:

SELECT (temp_kelvin - 2730) * 0.1 FROM mydevice