Smart Dehumidifier Control

smartapp_hvac

(Warren) #1

It might be my inept ability to search but I created an app that solves a couple of issues for me around my dehumidifier. I took a look at the app in the ST Public repository/store (Smart Humidifier) with the thought that I could just reverse it for dehumidification but it’s wicked old and only so-so at what it does. But, it did give some inspiration.

Anyhow, the Smart Dehumidifier Control, which is a very simple (maybe even crude!) app, allows you to control a dehumidifier using an external humidity sensor and a smart plug of some sort. It also gives you (push and/or SMS) alerts if the dehumidifier is running for longer than a desired number of hours. From experience, this is always how dehumidifiers seem to fail (evaporator dies and the thing just runs and ices up) and you might not notice unless you’re there and looking at it. The other thing that it does do is give you the option to define a “setpoint band” which allows the humidity to overshoot before the dehumidifier turns on and once it is on, it will dehumidify to an equally lower humidity. This allows for fluctuation in the humidity, which easily happens, and you get longer periods of off. In theory I think that will save energy.

For my personal setup, I use the following devices:

The “tricky” part about this is the humidity sensor reporting. Depending on the sensor it might not report changes very frequently or it could blast out a lot of noise (aka same readings). The Halo is a bit chatty but it seems to only report a change in humidity when there actually is a change. So, fairly responsive but not annoying. I can only guess that some of the battery powered sensors, you might have fewer reports in an effort to save battery but that too could be an issue. So far for me the Halo has been working in this “unintended purpose”.

Almost goes without saying but this app depends on your dehumidifier to be able to run continuously (i.e. have a drain) and be able to restart from power off. For those that are worried about turning on and off the power on the dehumidifier, don’t. It won’t shorten the life. I’ve been controlling window A/Cs this way using solid-state relays for 20 years (up until recently, now with ST!) without issues.

App Settings

  • Desired Humidity Setpoint: %RH that you want to target, defaults to 50% which is a good place to start

  • Also allow an overshoot of +/-: %RH that you want to allow above/below the setpoint before it turns on/off, defaults to 0% and can be up to 25%. 5% is a good place to start and if combined with the default setpoint of 50% would establish a 45%-55% band. Also helps to alleviate excessive switching since the %RH can fluctuate quickly.

  • Require a minimum off cycle time of this many minutes: A setting that allows you to not turn on the dehumidifier too soon. Most dehumidifiers have sensors in them to not run the compressor blindly but this ensures a minimum amount of off time. The default is 0 but 5 minutes is probably adequate if you need the feature. A dehumidifier that has this protection built in will typically run the fan for a period of time when powering up (very typical unless the dehumidifier is old).

  • Continuous Runtime Notifications: Here you set the desired notifications for a push or push+SMS. It’s also where you set the runtime threshold “Maximum Runtime (Hours)” which defaults to 0 (no notifications ever) and up to 48 hours. This will depend on how long you expect the dehumidifier to cycle. I think something like 2 or 4 hours is probably a good place to start but it really depends on the dehumidifier and the space it runs in.

  • Pause dehumidification while any of these doors or windows are open: Allows the dehumidifier to pause its operation while any door or window equipped with a contact (open/close) sensor is open so as to not waste electricity dehumidifying the earth. Also allows you to specify a maximum time for the door/window to be opened before pausing so as to not trigger during routine use. Allows you to monitor any number of doors or windows and won’t resume until all are closed again.

App logging

  • There is no “user” logging of routine operations in the Messages tab of the ST phone app but if you enable the alert (see above) you’ll get the push message which also will be logged there. The default push message is basically:
    Warning: Dehumidifier has run continuously for more than 2 hours. Humidity is 62%
  • There is plenty of debug logging that the app does and you can see from the Groovy IDE. Messages include the current %RH changes that are reported to the app and if the dehumidifier is on, and for how long, or off and when it is turned off how long it ran for. A typical message (one of them anyway) is:
    humidity is above 45% +/-5%, humidifier has been running for 107 minutes

Code
I’m still debugging but it seems pretty stable so here’s the current code. Any comments are of course welcome!


What should I get to control my dehumidifier?
(Ben Dattilo) #2

Good app, but last year I tried something similar, and constant cutting of power to my dehumidifier while the compressor is running did end up breaking my dehumidifier, as many require the compressor to run a ‘cool down’ cycle before turning off.

I fixed this by using the Zooz Zen15, and only cutting power when the power draw on the dehumidifier was less than x Watts.

//
/* Dehumidifer Control */
/
/
/* Author : Ben Dattilo /
/
Created : 5/19/2018, 8:27:05 PM /
/
Modified : 5/20/2018, 12:39:38 PM /
/
Build : 11 /
/
UI version : v0.3.104.20180323 */
/**************************************************************/

execute
if
(
Time is between 10:00:00 PM and 7:00:00 AM
and
Basement Sensor’s motion was not active for at least 10 minutes
and
Basement Sensor’s humidity is greater than or equal to 50%
and
Basement Dehumidifier’s switch is off
)
then
with
Basement Dehumidifier
do
Turn on;
end with;
end if;
if
(
Time is between 7:01:00 AM and 9:59:00 PM
and
Basement Dehumidifier’s switch was on for at least 10 minutes
and
Basement Dehumidifier’s power was less than 10W for at least 59 seconds
)
then
with
Basement Dehumidifier
do
Turn off;
end with;
end if;
end execute;


#3

It would be great if this could incorperate the cool down cycle that Ben mentioned. IF switch is off AND Watts is below X Watts THEN physically shut off switch. That way when the app signals to turn off the plug it waits until the dehumidifier enters a cool down cycle.


(Warren) #4

Interesting. I doubt cutting the power caused the issue. It could be turning it on again too soon though. It’s not like a projector bulb that would fry itself if you yank the cord. Most modern ACs or dehumidifiers have temp sensors that won’t turn on the compressor if it is at temp or pressure points or if it is iced over. Plus the banding features basically ensure that the dehumidifier has adequate time to cool off and melt any ice.

I’m not saying that a dehumidifier will like it, just that I doubt this killed it

I’ll take a look at the Zooz data to see how it cycles.


(Warren) #5

The other thing to keep in mind is that the compressor isn’t cooled per se. It shuts down and the fan continues to blow through the coils and evaporator. The purpose of this is to actually equalize the temps and evaporate condensate. The compressor is still hard shutting off since it only has two states: Engaged or disengaged. I think they key is to get a dehumidifier that has an auto restart feature which ensures the compressor won’t engage until the coils are warm and pressure low.

Given the Consumer Reports estimation of the lifespan of a humidifier being 5 years or less it’s probably more related to that.

I too was wary of this but after controlling a window AC for nearly 20 years using relays I feel pretty good that it’s not a killer. But let me see what I can figure out in code.


#6

That all makes sense. So I am concerned that the humidifier will get turned on before it has had enough time to cooldown/defrost. Could a cool down time be added to allow for control of how long it will wait to turn on the switch after being turned off?

The “setpoint band” feature will probably suffice but I’ve noticed that humidity fluctuates quickly in my craw or my Aeon sensor is just really sensitive. It would be nice to have something hard coded so that you know its not turning on/off too frequently.


#7

I finally got around to installing this and I cant get it to install. I just get the “somethings wrong” error on the app when adding the smartapp. I could just be copy/paste that messed things up, do you have a gitlab repo for this?


(Warren) #8

Adding a minimum time off wouldn’t be hard. But your dehumidifier probably has the protection built in. If the book doesn’t spec it, you can check by simply turning it to the minimum setting and let it run for several minutes with the compressor on and yank the cable. Then within a couple seconds, plug it back in. If the fan runs for a bit before engaging the compressor you’re golden. If the compressor immediately kicks in then it might not have the smarts. Or it might and it feels ok so it starts up the compressor.

As far as fluctuating a lot, that depends on the space but the banding in theory should help. But if it’s really a wet space and the dehumidifier can’t keep up then its going to want to run all the time. Also make sure the sensor is in a spot that is not subject to drafts or the fan.

I do have a repo but I never use it. Maybe it’s a good excuse to do so but a select all and paste should do it. Did you get any errors when you did a Save and then doing the Publish…for me? If not, code is probably intact. If you just get the error when adding the app from the My Apps section then I would suggest turning on live logging in the IDE and trying it to see what errors are logged. Post or DM them and I’ll take a look.


#9

I couldn’t find find anything in the logs related to this app, neither could support. I chatted with them for a bit because I had 9 instances of this app in my installed app list but could not use or remove any of them, support was able to remove them. I noticed this app says it requires OAuth, is that really necessary for it to work? Either way enabling it didnt not seem to help.

From support: “Honestly, I don’t know anything in the IDE gives that kind of logs but they might have a better idea, I can say that I am getting an error when I try to open them for details meaning the simple act of viewing what the app in the ide causes a failure.”

Side note: when I install it with the simulator in the ide it works fine


(Warren) #10

The simulator is cursed - I had lots of issues with it. I also had numerous instances of apps that were tied to use by the simulator. You have to uninstall the simulator first before you can uninstall the app is what I found out.

The app does not require OAuth, not sure why it would be on. Note that the checkbox “App needs third party authentication” is enabled by default but under the OAuth section you should still see the “Enable OAuth in SMart App” button as this would not be enabled by default.

I’ll install it again myself just to see if I can run into anything.


(Warren) #11

Ok, so I did the following steps:

  1. Using MS Edge, copied the above code
  2. Went into the IDE under My SmartApps, clicked +New Smartapp
  3. Selected “From Code”
  4. Pasted in the copied code but changed the version number to make it easy to tell the difference
  5. Clicked Create
  6. Clicked Publish…For me
  7. On the phone app, added new app and selected My Apps where I found the app with the changed version number
  8. Selected the initial options - selecting the Zooz plug and a humidity sensor and and Overshoot of 0 with an alert time of 1 hour and a target RH of 60 and then clicked Done
  9. The following messages were generated in the IDE logging, which is expected:
    ‎3‎:‎02‎:‎02‎ ‎PM: debug Updated with settings: [dehumidifier:Dehumidifier, humiditySensor:Kitchen Smoke Alarm, humiditySetpoint:60, humidityOvershoot:0, maxRuntime:1]
    ‎3‎:‎02‎:‎02‎ ‎PM: debug Installed with settings: [dehumidifier:Dehumidifier, humiditySensor:Kitchen Smoke Alarm, humiditySetpoint:60, humidityOvershoot:0, maxRuntime:1]
  10. Deleted the Smartapp from the moble app

So, not quite sure where the issue is but if you can Publish it OK then it should be workable. I never got any errors or problems at all though.

Do you get the error when you try to save the initial options in the mobile app or when you do the installation in the mobile app before the options page is shown? If you at least see the options page then I am wondering if it is having an issue with one of the devices selected (the switch or the sensor).

Something funny is up for sure but I don’t think it is the app per se.


(Warren) #12

Oh, and BTW, just to be clear, there are two different logs.

  1. The “Live Logging” that you see from the IDE’s main page
  2. The app or device event logs that are under (in this context) the app: My Locations -> smartapps -> Other -> Name of App -> List Events -> All

Above in step 9, I pasted in the Live Logging messages

Instead if you look at the events for the app itself, you should see some things. The app will show up on the list as soon as you try to install it, even before you select the initial options. And it is historical so it will show you everything from the last like 2 weeks - but it doesn’t auto update so you need to refresh the page to see new events. If I look at the event log when following the steps, I get this which basically mirrors what you see in the Live Logging:


(Warren) #13

I updated the code (see the top) to include a minimum cycle off time setting. Update the app to the v1.1 code and specify the required amount of desired time or 0 to let the dehumidifier decide.


(Mavrrick) #14

I had done something similar. I took a old auto adjusting humidifier app and updated it to manage both high and low values. It isn’t pretty, but so far in my testing it works.


#15

Im getting stuck at step 7, as soon as I select the app to install it gives the “something went wrong error”. It does show up in my installed app list (can not be deleted) but with the same error. Thanks for debugging it just must be something on my end, I was migrated to a samsung account in the beta but I dont think that would matter…


(Warren) #16

Yeah, I wonder if any app would install. Support should step up here.


#17

Yeah I dont know whats going on, I grabbed a random Rboy app and it installed no problem.

Has anyone else following this thread installed this successfully?


(Warren) #18

Just out of curiosity, are you using the update v1.1 app or the original one? There shouldn’t be any difference but while making the v1.1 changes I tweaked a few things in code to avoid some typecasting issues that could arise. But, seeing as though you are having an issue at installation, I don’t think that is even in play. It’s odd that Support wasn’t able to find any log anywhere as to the error.

One idea that might give us a datapoint is to install the code with just the stuff that should be happening at install and nothing else. I chopped it down to just that if you want to try it.

def appVersion() {
	return "Test"
}

definition(
    name: "Smart Dehumidifier Control v${appVersion()}",
    namespace: "LLWarrenP",
    author: "Warren Poschman",
    description: "Control dehumidifier based on relative humidity from an external sensor",
    category: "Convenience",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/water_moisture.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/water_moisture@2x.png",
    iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Meta/water_moisture@2x.png")

preferences {
	section("Smart Dehumidifier Control v${appVersion()}")
   	section("Control which Dehumidifier:") {
		input "dehumidifier", "capability.switch", required:true
	}
	section("Use the following humidity sensor(s):") {
		input "humiditySensor", "capability.relativeHumidityMeasurement", required:true
	}
	section("Desired Humidity Setpoint") {
		input "humiditySetpoint", "number", title: "Setpoint % RH", defaultValue: 50, required:true
	}
	section("Also allow an overshoot of +/-:") {
		input "humidityOvershoot", "number", title: "Overshoot % RH", range: 0..25, defaultValue: 0, required:true
	}
	section("Require a minimum off cycle time of this many minutes:") {
		input "minCycleTime", "number", title: "Minimum Off Cycle (Minutes)", defaultValue: 0, required:true
	}
	section( "Continuous Runtime Notifications" ) {
		input "maxRuntime", "number", title: "Maximum Runtime (Hours)", range: 0..48, defaultValue: 0, required:true
		input "messageText", "text", title: "Custom Runtime Alert Text (optional)", required: false
		input "phone", "phone", title: "Phone Number (for SMS, optional)", required: false
		input "pushAndPhone", "enum", title: "Both Push and SMS?", required: false, options: ["Yes","No"]
	}
}

def installed() {
	log.debug "Installed with settings: ${settings}"
	subscribe(humiditySensor, "humidity", humidityHandler)
}

def updated() {
	log.debug "Updated with settings: ${settings}"
	unsubscribe()
	subscribe(humiditySensor, "humidity", humidityHandler)
}

def humidityHandler(evt) {
	log.debug "humidity changed to: ${evt.value}%"
	def currentHumidity = Integer.parseInt(evt.value.replace("%", ""))
}

// END OF FILE

(Warren) #19

For anyone following the thread, I finally got around to putting this up in GitHub so I deleted the original code that was at the top and subbed in some GitHub links.

@David_Van Not sure if you’ve tried the “slimmed down” version above for debug but if you’re worried about cut and paste this should hopefully alleviate those concerns.


#20

I didnt have any luck with the slimmed down version or installing from github. Im baffeled :man_shrugging:

There is good news… It looks like the instance I installed in the ide simulator is still running and controlling things properly.