SmartThings Community

Smart Dehumidifier Control


(Warren) #41

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…

(Eran Salomon) #42

Thanks, I’m getting the following error while trying to update the smart app:

(Warren) #43

Ahh, the infamous smart quotes cut and past thing. In the line above, delete the second set of double quotes and redo them in the editor. It should be fixed.

Mail]( for Windows 10

(Warren) #44

Actually, I see the same thing on both the first two lines so just delete the quote character and redo it on both to be sure.

Mail]( for Windows 10

(Eran Salomon) #45

Great, many thanks, that fixed it and the smart app is working now!

(Warren) #46

v1.7 is up on GitHub.

The change is just to ensure that if %RH is reported as a fractional percent it is rounded to the nearest whole %RH for those sensors that don’t automatically do this. Given that most devices think about %RH in terms of 5% increments and that indoor humidity can change rapidly, working at a 1% precision level should be fine.

Thanks to @esalomo for finding this bug!


I get the “updating” notice. I am using a Xiaomi temperature/humidity sensor.

This is what the log for the sensor shows.

5:28:05 PM: debug Bedroom: Parse returned [name:humidity, value:54, unit:%]
5:28:05 PM: debug Bedroom: Parsing description: humidity: 54.14%
5:28:05 PM: debug Bedroom: Parsing description: humidity: 54.14%
5:28:05 PM: debug Bedroom: Parse returned [name:temperature, value:18.1, unit:C, descriptionText:Bedroom temperature is 18.1°C, translatable:true]
5:28:05 PM: debug Bedroom: Parsing description: temperature: 18.09
5:28:05 PM: debug Bedroom: Parsing description: temperature: 18.09

(Warren) #48

Can you provide the logs from the app itself? It might be similar to the previous issue but it would be good to see what the app is seeing and any errors it throws.


Hopefully these are the logs you refer to.

(Warren) #50

Well, not exactly. The one at the top is close (I would suggest clicking “all” in the top line instead of “from smartapp” and that will show you more. But the best thing to do is under Live Logging and filter by clicking on the app name as it appears (if it doesn’t, you can force it to appear by saving the settings in the app which will write a couple of lines to the log). Feel free to send the “all” log and the Live Logging filtered output. DM me if you like.