I am looking for a SmartApp that will turn the Dehumidifier on when the humidity level reaches a certain % and then turn off when it hits the target %. Ideally I would like to do this during certain times of the day only.
Anyone have something>?
I am looking for a SmartApp that will turn the Dehumidifier on when the humidity level reaches a certain % and then turn off when it hits the target %. Ideally I would like to do this during certain times of the day only.
Anyone have something>?
I use this. As my office has an AC installed as well, I added the option to start that up as well when the temp was above a certain minimum and RH was high.
/**
* Humidity Warning
*
* Author: Cor Dikland
* cdikland@gmail.com
* Date: 2015-01-11
*/
definition(
name: "Humidity Monitor",
namespace: "ckdikland",
author: "Cor Dikland",
description: "Monitor Humidity ranges",
category: "Convenience",
iconUrl: "http://icons.iconarchive.com/icons/icons8/ios7/512/Very-Basic-Home-Filled-icon.png",
iconX2Url: "http://icons.iconarchive.com/icons/icons8/ios7/512/Very-Basic-Home-Filled-icon.png"
)
preferences {
section("Enable Humidity Control?"){
input "isEnabled", "bool", title: "Enable the De-humidifier/AC on/off control", defaultValue: true, refreshAfterSelection: true
}
section("Humidity Sensors"){
input "exSensor", "capability.relativeHumidityMeasurement", title: "Choose Sensor"
}
section("Humidity"){
input "minHum", "number", title: "Minimum Humidity"
input "maxHum", "number", title: "Maximum Humidity"
}
section("Turn on a De-humidifier...") {
input "switch1", "capability.switch"
}
section("Turn on an AC...") {
input "switch2", "capability.switch", required: false
input "minTemp", "number", title: "Minimum Temperature"
}
section("Event Reporting"){
input "report", "bool", title: "Report Humidity Changes?", defaultValue: false, refreshAfterSelection: true
}
section("Contacting You"){
input "phone1", "phone", title: "Phone Number (Optional. Push Notification will be sent if left blank)", required: false
input "freq", "decimal", title: "Frequency of notifications (In minutes. Only one notification will be sent if left blank.)", required: false
}
}
def initialize() {
log.debug "****************************************************** "
def swtch1=switch1.currentValue("switch")
def swtch2=switch2.currentValue("switch")
if (isEnabled) {
subscribe(exSensor, "humidity", eHumidityHandler)
subscribe(exSensor, "temperature", eTemperatureHandler)
subscribe(switch1, "switch.on", onHandler)
subscribe(switch1, "switch.off", offHandler)
subscribe(switch2, "switch.on", onHandler2)
subscribe(switch2, "switch.off", offHandler2)
if(swtch1=="on") {
state.switchState = 1
}
else {
state.switchState = 0
}
if(swtch2=="on") {
state.switch2State = 1
}
else {
state.switch2State = 0
}
state.currentHum = 0
log.debug "Humidity Control is enabled. "
log.debug "Min Humidity is $minHum"
log.debug "Max Humidity is $maxHum"
log.debug "Min Temperature before turning on A/C is $minTemp"
}
else {
log.debug "Humidity Control is disabled. "
}
def exHum = exSensor.latestValue("humidity")
def exTemp = exSensor.latestValue("temperature")
log.debug "Current Humidity is $exHum %"
log.debug "Current Temperature is $exTemp"
log.debug "Switch1 is $swtch1. State=$state.switchState"
log.debug "Switch2 is $swtch2. State=$state.switch2State"
log.debug "****************************************************** "
}
def installed() {
initialize()
}
def updated() {
unsubscribe()
initialize()
}
def onHandler(evt) {
log.debug "*** Dehumidifier has been turned on. ***"
def exHum = exSensor.latestValue("humidity")
if(exHum < minHum){
def difHumLo = (minHum - exHum)
log.debug "The humidity is $exHum percent which is $difHumLo degrees below the desired level. The Dehumidifier should not have been turned on."
}
state.switchState = 1
}
def offHandler(evt) {
log.debug "*** Dehumidifier has been turned off. ***"
def exHum = exSensor.latestValue("humidity")
if(exHum > maxHum){
def difHumHi = (exHum - maxHum)
log.debug "The humidity is $exHum percent which is $difHumHi degrees above the desired level. The Dehumidifier should not have been turned off."
}
state.switchState = 0
}
def onHandler2(evt) {
def exTemp = exSensor.latestValue("temperature")
log.debug "The Temperature is $exTemp."
state.switch2State = 1
log.debug "*** AC has been turned on. Switch State =$state.switch2State ***"
}
def offHandler2(evt) {
def exTemp = exSensor.latestValue("temperature")
log.debug "The Temperature is $exTemp."
state.switch2State = 0
log.debug "*** AC has been turned off. Switch State =$state.switch2State ***"
}
def sendNotifyCh() {
def exHum = exSensor.latestValue("humidity")
if (phone1) {
sendPush("The new humidity reading $exHum percent. Previous reading was $state.currentHum percent.")
}
state.currentHum = exHum
}
def sendNotifHi() {
log.debug "The humidity is higher than the Maximum level of $maxHum set in Preferences."
log.debug "sendNotifHi START: switch1 state = $state.switchState. switch2 state = $state.switch2State"
if (state.switchState != 1) {
def exHum = exSensor.latestValue("humidity")
def difHumHi = (exHum - maxHum)
def exTemp = exSensor.latestValue("temperature")
log.debug "The humidity is $exHum percent, $difHumHi % above optimal percent range. Turning on switch."
if (phone1) {
sendSms(phone1, "The Humidity is $exHum percent, $difHumHi degrees above optimal percent range.")
}
else{
if (report) {
sendPush("The humidity is $exHum percent, $difHumHi degrees above optimal percent range.")
}
}
switch1.on()
state.switchState = 1
if (switch2 && exTemp > minTemp) {
log.debug "The current temperature of $exTemp is higher than the temp set in preference. The AC will be turned on."
switch2.on()
// state.switch2State = 1
}
}
log.debug "sendNotifHi END: switch1 state = $state.switchState. switch2 state = $state.switch2State"
}
def sendNotifLo() {
log.debug "The humidity is lower than the Minimum level of $minHum set in Preferences."
log.debug "sendNotifLo START: switch1 state = $state.switchState. switch2 state = $state.switch2State"
if (state.switchState != 0) {
def exHum = exSensor.latestValue("humidity")
def difHumLo = (minHum - exHum)
log.debug "The humidity is $exHum percent, $difHumLo percent below optimal humidity range. Turning off switch."
if (phone1) {
sendSms(phone1, "The humidity is $exHum percent, $difHumLo percent below optimal humidity range.")
}
else{
if (report) {
sendPush("The humidity is $exHum percent, $difHumLo percent below optimal humidity range.")
}
}
switch1.off()
state.switchState = 0
// log.debug "AC Switch state= $switch2.latestValue()"
if (state.switch2State !=0) {
def exTemp=exSensor.latestValue("temperature")
log.debug "The AC will also be turned off because the current humidity is below optimal. The current temperature is $exTemp"
switch2.off()
// state.switch2State = 0
}
}
log.debug "sendNotifLo END: switch1 state = $state.switchState. switch2 state = $state.switch2State"
}
def eHumidityHandler(evt){
def exHum = exSensor.latestValue("humidity")
log.debug "The humidity is $exHum percent. Previous reading was $state.currentHum percent."
if (exHum !=state.currentHum) {
sendNotifyCh()
}
if(exHum > maxHum){
if(freq) {
schedule("0 0/$freq * * * ?", sendNotifHi)
}
else{
sendNotifHi()
}
}
if(exHum < minHum){
if(freq) {
schedule("0 0/$freq * * * ?", sendNotifLo)
}
else{
sendNotifLo()
}
}
}
def eTemperatureHandler(evt){
def exTemp = exSensor.latestValue("temperature")
log.debug "eTemperatureHandler START: Latest Temp = $exTemp. switch2 state = $state.switch2State"
if (exTemp <= minTemp && state.switch2State !=0) {
log.debug "The Temperature of $exTemp has fallen below the minimum temperature of $minTemp set in Preference. Turning off the AC"
switch2.off()
// state.switch2State = 0
}
log.debug "eTemperatureHandler END: Latest Temp = $exTemp. switch2 state = $state.switch2State"
}
Oh, btw. The code has a bunch of sendPush statements that I used for mostly monitoring/debugging. Remove or replace with log.debug at will
Can you post the code without the scroll bars, I cant copy and paste. Thank You!
@cdikland Edited your post to display code block instead of a block quote.
Thank you very much. How did you do that? Always bugs me when I try to post code and end up with such mess.
No idea how but obviously it possible as Tim edited my post. Be sure to thatnk him
When you create a post with code you select all the code and then his the </> button.
This can also be accomplished using the SmartThings channel in IFTTT.
https://play.google.com/store/apps/details?id=com.ifttt.ifttt