I am attempting to modify the “Notify Me When” app to send me a push notification when acceleration stops (to indicate the dryer is done). I am in no means a developer. I just tried setting the subscribe event to inactive, but maybe I’m missing something. I have seen some posts mentioning something like this in the forums. Does anyone have any code they can share for this?
Hi @mquirante – Here’s an some example code from one of our developers at SmartThings that’s designed to turn on a light switch when the washer/dryer is done:
All you’d need to do is remove the preference input section for the switch, and instead of doing switch1.on() in the turnOn() method, you’d do:
I tried it out over the weekend and I wasn’t able to get it to work properly. Here’s the code I used:
/**
* Laundry is Done
*
* Author: meghann.quirante@usability.pro
* Date: 2013-08-21
*/
preferences {
section("When this dryer/washer...") {
input "sensor1", "capability.accelerationSensor"
}
section("Has stopped for this number of minutes...") {
input "timePeriod", "decimal", title: "Minutes"
}
}
def installed()
{
subscribe(sensor1, "acceleration", accelerationHandler)
}
def updated()
{
unsubscribe()
subscribe(sensor1, "acceleration", accelerationHandler)
}
def accelerationHandler(evt)
{
// this method will be called whenever virbration starts or stops
log.trace "$evt.name: $evt.value"
if (evt.value == "active") {
// If vibration is active, unschedule the turning on of the switch
unschedule("turnOn")
} else if (evt.value == "inactive") {
// If vibration is inactive, start the timer
runIn(timePeriod * 60, turnOn)
}
}
def sendMessage(evt) {
// Send Push notification (and/or whatever else you want to do when the washer stops)
sendPush( "Laundry is done yo!" )
}
In fact, I’m not sure the Multi is working properly. It always says its “Open” and “Active” even though its just sitting there when the dryer isn’t in use.