I see that I can easily offset/correct the temperature value but cannot do the same for humidity readings. Is this feature missing (forthcoming?) from the ST Dev. Team or is there a tweek that I can make via the IDE to add the ability to compensate for humidity readings that are off?
Hi @mrmedia, There have been discussions about temp offsets, but I don’t recall any for humidity. I can see situations where you’d like to make sure the sensor is the same as in an appliance or some other built-in sensor. You could write your own device type modeled after ST’s and tweak the code for reading and displaying humidity values. I’d at least submit a feature request to email@example.com.
If you only need to adjust +/- 1%, you can do so by modifying a value in the device handler on this line:
def pct = Integer.parseInt(value.trim(), 16) / 100
Change the 100 to either 99 or 101. 99 = +1% RH offset; 101 = -1%. Because of rounding and other math operations going on that I don’t fully understand, it’s not accurate for greater or smaller values of offset.
Is + - 1% the max adjustment that can be expected? I actually need to be able to compensate for more then that amount.
It’s the max that can be achieved with any degree of accuracy, using the method I described. You can substitute a smaller number to get a greater positive offset, but in doing so, you’ll likely introduce non-linearity. That is, there is not a 1-to-1 relationship between divisor and offset; if you tweak it to read correctly at 45%, it’ll be wrong at higher and lower values.
To do this correctly really requires ditching the current rounding/truncating method and using two decimal place precision, which is beyond my current understanding of Groovy.
It makes sense what you’re saying … Guess I thought the quality of the actual sensor chosen inside the sensor would’ve been more accurate / higher grade build.
Thx for your feedback - now lets enjoy the holidaze playing in our smarthomes.