Pet notification with vibration sensor

Hi Hubitat community,
First, I've got some background to a possibly clever solution for geriatric pet owners.

Problem statement: Our very old dog needs to be physically carried outside at random, and no longer sees/hears/barks or moves very fast. He knows he needs to go outside and gets up and walks around prior to doing so, but can no longer communicate that need. He sleeps 23.5h/day so when he wakes up from a nap he basically needs to go out within 2-3 minutes or he will have an accident. My wife and I both work from home most of the day, but sometimes we will be in a call or on a different floor of the house and not hear him wake up. The goal should be obvious, but ideally we can go let him out and avoid an accident.

Ideal solution: I can get a notification on my phone via the Hubitat app (or flash a light, have a smart speaker announce, etc.) when he wakes up after being asleep for more than 20 minutes and has been in motion for more than 2 minutes straight (meaning - he is walking and not just adjusting his sleeping position).

I am CLOSE to what I would consider ideal operation of it, but would appreciate some help with the rule machine tweaks. I am open to any/all suggestions if I've done this wrong. I already know how to set/send the various notifications so that is not an issue.

Scenario/Proposed Solution: I've got an Aqara zigbee vibration sensor (DJT11LM) paired and the community (Xiaomi/Aqara/etc) driver loaded so the sensor reports variables of tilt, motion, presence, accelleration, battery, temp, etc. I am only using the motion report of active or inactive to determine his movement, no other variables.

The sensor is attached to his collar (it is very small and light, he doesn't notice it). I realize it will kill a few batteries if used constantly, but don't really care as they are CR2032 and $0.75/ea. I am getting events logged when the sensor moves or stops moving so that is all working fine.

My initial rule basically had an action that would trigger when the motion sensor was "inactive" for 20 minutes, then became active for more than 2 minutes straight. It would then notify my phone via the Hubitat App.
This seems basically only tell me if he hasn't moved AT ALL for 20 minutes. I'm pretty sure I need some IF/THEN statement to eliminate false activity (dog adjusts his sleeping position, but hasn't stood up/woken up) from resetting the 20 minute counter.

Questions:
1) Should I be using the trigger event of the sensor being inactive for 20 minutes OR just use the inactive state as the binary trigger and deal with the 20 minute delay in an action?
2) If I'm dealing with the 20 minute delay in an action IF/THEN, what should I tweak about the syntax below?
3) What's the best/proper way to do this?

I'm toying with this as a new rule to use, but unsure if it will yield the correct result.

Instead of just trial and error I figured I'd post here in case anyone has a better solution or a similar use-case in the future when searching. VERY thankful to the community for any replies.

image
this is a rule i use for my door contacts that are resettable based on the door position. i would assume you could do something similar with the motion sensor.

Trigger: motion sensor motion changes
Action: If motion is active
send notification (light, phone alert, etc) -> delayed 2min (cancelable)
ELSE
Cancel delayed actions
ENDIF

this will only notify you if Oscar is active for 2 minutes, and does not have a 20 minute delay

One approach that might work:

Trigger: Motion inactive and stays that way for 0:20:00

Actions to run:

Wait for condition: Motion active --> duration 0:02:00`
Notify: "Dog!"

However, this depends on some things that you'd have to verify with your sensor--like just because he's basically moving around for 2 minutes doesn't necessarily mean the sensor will report motion active for that whole time (how many seconds does he need to stop for before it flips back to inactive? if this sensor is using "motion" for vibration, it's often not very long if it's like the ST Multisensor I've used in the past via its acceleration attribute). Depending on his habits, maybe you also want to not need to wait the full 20 minutes for the "wait for 2 minutes of motion" thing to get cancelled/reset--but this is just one basic idea.

@Bee-Rad

Does your dog usually sleep in the same place(s)? You could get pressure mats for all his dog beds, and get notified anytime all of them are unoccupied for more than 5 minutes.

That way, the sensors don’t move around. I’m describing this because those Aqara sensors like to stick to a single zigbee repeater, and I fear it’ll drop off the mesh when your dog moves around.

3 Likes

Appreciate the reply.
That's a really good idea but he sleeps all over the place unfortunately, and we take him upstairs at night to our room and then he sleeps in random places there also. I haven't had it drop off yet that I can tell, but will watch for that. I haven't had it on him very long but he's usually in a pretty open area or near the main hub.

Is there a good/easy way to check which node it is connecting to and test that range? (off topic, I know)

Not without an Xbee3.

How about putting a tilt sensor on the collar in a way that would detect a change to an upright position?

Zooz 700 Series Z-Wave Plus Tilt | Acceleration XS Sensor ZSE43 for Garage Door and Gate Monitoring. Hub Required (Sold Separately). Compatible with SmartThings, Hubitat, and Home Assistant Z-WaveJS.

Another great suggestion, however the one I have does measure tilt and it seems to register a tilt event just as often as motion/acceleration. Pasted the log of the last handful of events further below.

I think the biggest issue with tilt may be that a dog's collar isn't always in the same orientation while they sleep. This dog does tend to either sleep on his side, or head laying down in the same orientation to vertical axis as if he was standing. Not that any solution will eliminate false alarms completely, but I think this is do-able with a motion sensor.

Definitely appreciate the input provided so far by everyone and I'm looking into my rule as a result. I'll report back if I manage to nail this.

Sounds good.

I am also a fan of the "bacon sensor"!

PSX_20221114_200221

1 Like

Download the Hubitat app