How to modify sensor value from MQTT binding before it gets persisted in influxdb

Tags: #<Tag:0x00007f616c82fb48> #<Tag:0x00007f616c82fa58> #<Tag:0x00007f616c82f8c8>

I use OH 2.1 with a bunch of Sonoff Basics with ds18b20 temperature sensor running Espurna firmware. The problem I noticed is that the temperature readings are off by a few degrees due to a difference in the Vcc voltage on each Sonoff module. The voltage can vary between 3.1-3.3V on different modules. Because of that, the temperature readings are inaccurate. Espurna firmware automatically sends the readings to an MQTT topic. I’d like to adjust the values on the OH2 side before they get persisted and displayed on my dashboard. Is this possible? Is this the right approach? I know I could make a modification on the firmware level but I’d like to avoid it. If for whatever reason Vcc changes due to the input voltage fluctuation I’d have to update the firmware on every Sonoff. That’s not optimal. I’d like to be able to adjust values right from OpenHab.

My plan B is to add a configurable correction value to the firmware, but I will only do it if you tell me that I can’t do what I want in OH.

one way would be to use a Proxy item and a rule

get the regular reading from the mqtt bound item, then trigger a rule that corrects the value and stores it as the state of the Proxy item. then persist and graph the proxy.