Aeon Multi Humidity

I have my Aeon multi in my gun safe. I have it set up to push notify me if there is motion or if the temp gets too high. I cant figure out how to alert me when the humidity rises too high.

I think you are in the SmartApp writing zone for that, as of right now.

I have the code written, but I am running into a problem simulating. It appears the Aeon only sends humidity like every 3 or 4 hours (annoying to test with)

So when I create a virtual humidity device, it reports its evt.value as 40% and not an unformatted number like 40 so when I try to do any math with it I get an error. According to my real Aeon multi events, the evt.value is properly formatted as a number.

—fixed with Double.parseDouble(evt.value.replace("%", “”)) —

Updated

Working code to sense humidity, and trigger a push notification, SMS and turn on a switch based on crossing the upper threshold

/**
 *  Its too humid!
 *
 *  Copyright 2014 Brian Critchlow
 *  Based on Its too cold code by SmartThings
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */
definition(
    name: "Its too humid!",
    namespace: "",
    author: "Brian Critchlow",
    description: "Notify me when the humidity rises above the given threshold",
    category: "Convenience",
    iconUrl: "https://graph.api.smartthings.com/api/devices/icons/st.Weather.weather9-icn",
    iconX2Url: "https://graph.api.smartthings.com/api/devices/icons/st.Weather.weather9-icn?displaySize=2x"
)


preferences {
	section("Monitor the humidity of:") {
		input "humiditySensor1", "capability.relativeHumidityMeasurement"
	}
	section("When the humidity rises above:") {
		input "humidity1", "number", title: "Percentage ?"
	}
    section( "Notifications" ) {
        input "sendPushMessage", "enum", title: "Send a push notification?", metadata:[values:["Yes","No"]], required:false
        input "phone1", "phone", title: "Send a Text Message?", required: false
    }
	section("Turn on a switch:") {
		input "switch1", "capability.switch", required: false
	}
}

def installed() {
	subscribe(humiditySensor1, "humidity", humidityHandler)
}

def updated() {
	unsubscribe()
	subscribe(humiditySensor1, "humidity", humidityHandler)
}

def humidityHandler(evt) {
	log.trace "humidity: $evt.value"
    log.trace "set point: $humidity1"

	def currentHumidity = Double.parseDouble(evt.value.replace("%", ""))
	def tooHumid = humidity1 
	def mySwitch = settings.switch1

	if (currentHumidity >= tooHumid) {
		log.debug "Checking how long the humidity sensor has been reporting >= $tooHumid"

		// Don't send a continuous stream of text messages
		def deltaMinutes = 10 
		def timeAgo = new Date(now() - (1000 * 60 * deltaMinutes).toLong())
		def recentEvents = humiditySensor1.eventsSince(timeAgo)
		log.trace "Found ${recentEvents?.size() ?: 0} events in the last $deltaMinutes minutes"
		def alreadySentSms = recentEvents.count { Double.parseDouble(it.value.replace("%", "")) >= tooHumid } > 1

		if (alreadySentSms) {
			log.debug "Notification already sent within the last $deltaMinutes minutes"
			
		} else {
			log.debug "Humidity Rose Above $tooHumid:  sending SMS to $phone1 and activating $mySwitch"
			send("${humiditySensor1.label} sensed high humidity level of ${evt.value}")
			switch1?.on()
		}
	}
}

private send(msg) {
    if ( sendPushMessage != "No" ) {
        log.debug( "sending push message" )
        sendPush( msg )
    }

    if ( phone1 ) {
        log.debug( "sending text message" )
        sendSms( phone1, msg )
    }

    log.debug msg
}
1 Like

Being able to trigger smart outlets via humidity levels would be great! I assume this will be avail soon? Also too bad it reports humidity hours apart. That means things like dehumidifiers will run long using energy when they quite possibly don’t need to be.

You can install this right now by going into your own SmartApps in your account in the IDE site: http://ide.smartthings.com

It takes a bit of work but usually people can do it.

Of course, once this is officially published it can all be done in the mobile app.

I may give it a try. I’m in IT, but don’t code. I’ll see how handy I want to become in this arena. :smile:

I may wait for the app to be released, but who knows how long that may take.

Thanks, Ben!

I tried to submit the code for publishing but it wouldnt let me select the app in the IDE for the request. Any thoughts why?

@rono007
Give it a try! Its actually pretty easy to do via the IDE. Its mostly copy & paste the code. We can give you step by step if you want.
It would also be nice having someone else test my code and see if they experience the same refresh rate for humidity that I do. Maybe my Aeon is bonkers. :smiley:

My friend, give me the step-by-step if ya can (just in case). I will be happy to test it!

And thank you!

Log in to http://ide.smartthings.com

  • Go to the My SmartApps tab
  • Click the + New SmartApp button
  • Name the App anything arbitrary and the same for description and click create
  • Highlight all of the existing code and delete it. Then copy and paste my code in.
  • Click save then click publish>for me
  • The SmartApp will now show up on the ST phone app and you can configure the settings.

Thanks! I will report back once I have it working. :slight_smile:

1 Like

Code above has been submitted for publication review.

1 Like

Also be sure to push the “Configure” button for the Aeon Multicontroller immediately after you get it connected to your hub - this reprograms the default setup so that it remorts humdity every time that the humidity changes.

Then you can test it by blowing on it (seriously - your breath is enough to raise the humidity, if you blow in the right place ;o)

1 Like

Was it the namespace field? Needs to be populated.

sure was. I figured it out after watching your 5/28 dev discussion.

code updated for low threshold and submitted for review

2 Likes