Ok, so I think this will work but I would like to have you try it to be sure since I don’t have that Zooz sensor. The issue is simply that some (maybe most) sensors report %RH in whole (integer) values by rounding the value. In the case of the Zooz, it doesn’t do the rounding for you and just reports 100ths of %. I seriously doubt the sensor is < 1% accurate but anyhow it’s a valid way of reporting so we should catch that.
I verified these tweaks seem to work just fine with the whole % RH values and it should do the rounding for you if the % RH is reported as 10ths or 100ths (or well anything less than 1 % RH).
Before I release it, please give it a shot and let me know what errors or success you have please.
Edit the SmartApp and make the following changes to the humidityHandler() function :
From this:
def humidityHandler(evt) {
log.debug “humidity changed to: ${evt.value}%”
def currentHumidity = Integer.parseInt(evt.value.replace("%", “”))
state[frequencyLastRH(evt)] = currentHumidity
To This:
def humidityHandler(evt) {
def rawHumidity = Math.round(Double.parseDouble(evt.value.replace("%", “”)))
log.debug “humidity changed to: ${evt.value}% (${rawHumidity}%)”
def currentHumidity = rawHumidity.toInteger();
state[frequencyLastRH(evt)] = currentHumidity
And then do a Save and Publish, For Me to make it take effect Afterwards the app should start to use this code for the next execution. If you have any questions, let me know.
Thanks and let me know as soon as you have some results…