App for Multi Acceleration

I’m trying to find a smart app to tell me if my smart sense multi detects acceleration more than 1 time in X minutes. I can only find an app to say “don’t tell me if it detects acceleration more than once in X minutes”. I want to do the reverse - ONLY tell me if it detects acceleration more than once in a defined period of time.

If it helps to explain - I have a multi on my sump pump. I expect it to run daily. I don’t expect it to run twice in an hour. I want to know if it ran twice in an hour.

Can anyone point me to an app or help? Thanks.

Hi Greg,

I am looking for the same thing, and I thought it would be one of the first apps to be developed. I want to detect vibration (burglar knocking on the from door to see if somebody is home). When that is detected, I want to trigger an event somewhere. The only app I could find was some crazy thing to tell me the laundry was finished, but as you said, it works in reverse. Did not think I would need to program for that. I thought that IFTTT could help out, but the acceleration property does not appear in the recipes.

Cheers.

There is an app for the knocking function you are looking for already. You have to use the IDE to create a new app and there is a an app called “the knocker” or something like that. Its shared through the IDE.

As for the sump pump you’d have to make a smartapp that would have some logic like… If shaken turn xyz virtual switch on… Then after 1 hour turn virtual switch off. If vibration and virtual switch on… Send push notification.

If you need help with the app…I am getting some multis soon and could try and put something together.

Tim -

Thanks for the smart app suggestion. I have zero experience with coding or writing apps, other than copy/paste some of the code people have put in here so that I can use it. If you end up writing a multi app that I could use I would really appreciate it. Please let me know if you do.

I really wish there was just some master smart app that had every variable and action available to choose from. All the ones they have seem to be missing something. I don’t care if I had to sift through 80 things I don’t want it to do as long as I could make it do what I want it to do.

Greg,
It’s called IFTTT and it works some of the time. :frowning:

I have ifttt, but it doesn’t include all the actions or variables

This again would have been super helpful this past week. Here on the east coast we had lots of rain. My sump pump rain a lot. But I really don’t care unless it runs twice in a half hour. If anyone could help me with the code to only notify me if there is acceleration twice in 30 min I would really appreciate it.

bump? 01234567891011 (character minimum rules)

Well I read all the new documentation on the site and while it is more than was previously there it is still not geared to someone who has zero experience in coding. Regardless, I took a stab at trying to do what I want this app to do.

I’ve tried two things

  1. Modifying the “Notify me when app” - I found the frequency section and saw where it says > or = to for preventing multiple notifications. I edited it to be <= to and it doesn’t work at all.

    def eventHandler(evt) {
        if (frequency) {
            def lastTime = state[evt.deviceId]
            if (lastTime == null || now() - lastTime >= frequency * 60000) {
                sendMessage(evt)
            }
        }
        else {
            sendMessage(evt)
        }
    }

  2. I tried to modify the “mail has arrived” app. I found where it says

def accelerationActiveHandler(evt) {
    log.trace "$evt.value: $evt, $settings"

    // Don't send a continuous stream of text messages
    def deltaSeconds = 5
    def timeAgo = new Date(now() - (1000 * deltaSeconds))
    def recentEvents = accelerationSensor.eventsSince(timeAgo)
    log.trace "Found ${recentEvents?.size() ?: 0} events in the last $deltaSeconds seconds"
    def alreadySentSms = recentEvents.count { it.value && it.value == "active" } > 1

    if (alreadySentSms) {
        log.debug "SMS already sent to $phone1 within the last $deltaSeconds seconds"
    } else {
        log.debug "$accelerationSensor has moved, texting $phone1"
        sendSms(phone1, "Mail has arrived!")
    }
}

And I thought maybe if I flipped the last “If” and “else” it would work. Because all I want it to do is tell me if something happens twice in a designated period of time. Nope, doesn’t work.

I love my smart things. But I can’t see this ever being mainstream without there being an easy way for average consumers to get the results they desire.

Just wanted to post in here to close the issue - this app was solved by @tslagle1

Thanks