Okay so new problem. The else statement is always being done. I found if I move the log.debug “using else” line to after the else the log.debug works properly but both switches still change. If the humidifier.off() is after the else both switches and the log.debug is done every time. Any thoughts to why the else statement is always being done???
Here is all the code if you want to play.
definition(
name: “HVAC Humidifier”,
namespace: “mebaddog2002”,
author: “Michael Goldsberry”,
description: "This is for a whole house humidifier connected to the HVAC system. This app is designed to work with a steam style humidifier that only needs the HVAC fan on. It will turn on the HVAC fan and humidifier when the humidity drops below the set point. It will still work with the evaporate style humidifiers. Just note that it probably wont raise the humidity very much. It will not hurt the system if it comes on. It will only run the humidifier if your thermostat is set to heat. So no need to remove app during summer. You will need some kind of air proving switch so the app can verify that the fan is running. This app will also take into consideration the outside temp and automatically adjust your house humidity level so condensation does not develop on the inside of the windows. ",
category: “My Apps”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)
// TODO: put inputs here
preferences {
section(“About App”){
paragraph “This app will control a whole house steam humidifer. It will only work if the thermostat is in the heat mode. You need to install a fan air pressure proving switch in the duct work. This is so the humidifier does not run if the fan is not circulating air. As the outside temperature gets colder it will allow the humidity in the house to lower so condensation does not develop on the windows. During heating if the humidity drops it will turn on the humidifier. If the humidity is to low in the house after the heat turns off it will turn on the HVAC fan and the humidifier to raise the humidity level in the house.”
}
section(“Thermostat”) {
input “thermostat”, “capability.thermostat”, required: true, title: “Select Thermostat”
}
section(“Humidity Sensor”) {
input “humiditysensor”, “capability.relativeHumidityMeasurement”, required: true, title: “Select Humidity Sensor”
}
section(“HVAC Fan Proving Switch”) {
input “fanon”, “capability.switch”, required: true, title: “Select Fan Proving Switch”
}
section(“Outside Temprature Sensor”) {
input “outsidetemp”, “capability.temperatureMeasurement”, required: true, title: “Select Outside Temprature Sensor”
}
section(“Whole House Humidifier”) {
input “humidifier”, “capability.switch”, required: true, title: “Select Humidifier”
}
section(“Target Humidity Level”) {
input “humidity40p”, “number”, required: true, title: “Humidity Level Above 40 Degrees”, defaultValue:45
input “humidity30to39”, “number”, required: true, title: “Humidity Level Between 30 to 39 Degrees”, defaultValue:40
input “humidity20to29”, “number”, required: true, title: “Humidity Level Between 20 to 29 Degrees”, defaultValue:35
input “humidity10to19”, “number”, required: true, title: “Humidity Level Between 10 to 19 Degrees”, defaultValue:30
input “humidity0to9”, “number”, required: true, title: “Humidity Level Between 0 to 9 Degrees”, defaultValue:25
input “humiditylow”, “number”, required: true, title: “Humidity Level Less Then 0 Degrees”, defaultValue:20
}
}
def installed() {
log.debug “Installed with settings: ${settings}”
initialize()
}
def updated() {
log.debug “Updated with settings: ${settings}”
unsubscribe()
initialize()
}
// TODO: subscribe to attributes, devices, locations, etc.
def initialize() {
subscribe(humiditysensor, “humidity”, humidityControlHandler)
subscribe(fanon, “switch.on”, humidityControlHandler)
subscribe(fanon, “switch.off”, humidityControlHandler)
}
// TODO: implement event handlers.
def humidityControlHandler(evt) {
log.debug “humidityControlHandler called: $evt”
log.debug "fan on state ${fanon.currentSwitch}"
log.debug "Outside temp ${outsidetemp.currentTemperature}"
log.debug “Current humidity is ${humiditysensor.currentHumidity}”
//if(thermostat.thermostatOperatingState == “heat”)
//log.debug “heating”
if(fanon.currentSwitch == “off”) {
humidifier.off()
log.debug “humidifier off no fan”
}
if(outsidetemp.currentTemperature >= 40){/* && humiditysensor.currentHumidity < humidity40p) */
thermostat.fanOn()
log.debug "fan on command sent"
if(fanon.currentSwitch == “on”){
humidifier.on()
log.debug “humidifier on command sent”
}
} else log.debug "using else"
humidifier.off()
thermostat.fanAuto()
}