There are a lot of SmartApp developers here, for whom this might be a very easy task and could be able to help one of our pets (if it’s not simple, I’ll dive into the developer kit and try to figure my way around) - I’ve looked for something like this before and haven’t found it:
What I need, is effectively a “digital turnstile” that keeps track of the number of times motion has been seen within a timeframe, and can trigger an alert if there have been too many motion events within a period. Here’s the use-case – one of our cats gets urinary crystals, which can quickly turn into a very serious medical condition if it’s not noticed. We clean the litterbox daily, but we still want to be on top of the situation faster if it starts to flare up … but obviously we can’t sit in the house and watch the litterbox all day.
So what I had done before, was I had a WeMo motion sensor … which (via IFTTT) would advance a custom counter on NumerousApp (which has since been shut down). If that counter ever reached 8 (it was reset nightly), a different rule in IFTTT would send us alerts, change a certain bulb in our house to red, etc. It worked great for a couple years … but NumerousApp went offline a few months ago, so we’ve been flying blind.
This morning, we determined the cat is having a flare-up again (a check of the Nest camera over the litterbox confirms it) so we took him to the vet … and now I’m thinking it’s time I either try to write a SmartApp, or find some generous soul that could whip one together quickly. Roughly speaking, the SmartApp needs to allow the user to:
- Define a motion sensor to watch
- Define a threshold of what would be too many motion events within the timeframe (i.e.: 8)
- Define what that timeframe is (i.e.: 24 hours)
- Send alerts
There are two semi-tricky parts in that, though.
First … the motion sensor, needs to have a “cool-down period” after seeing a motion event. If the cat paces around the litter box for a while, they would keep triggering the motion sensor. IFTTT handles this really well with WeMo motion sensors, you just define a “cool down” interval of 5 minutes, 15 minutes, whatever makes sense.
Second … keeping a rolling “last X hours” view requires a lot of keeping stateful information. I couldn’t actually do this with IFTTT+NumerousApp … so what I decided would be perfectly acceptable was simply resetting the counter to zero at midnight, and then a simple “if counter > X then alarm” condition.
Has anyone ever seen a SmartApp here along those lines?