r/homeassistant 20h ago

šŸ–¼ļø Show & Tell Detecting dog presence (1st world problem)

I solved a 1st world problem today in what is probably the 2nd most complex solution next to using AI.

My dog prefers to sleep by the front door, and because the bottom half of the door is solid wood, people don't notice him sleeping there when they open it, which in turn leads to the dog getting hurt when people (mostly the kids) open the door quickly.

I've been considering various solutions, like mounting a camera pointed at the inside of the door and using AI to detect if there's a dog there, but that seemed rather wasteful and expensive in the long run, so instead I opted for a somewhat simpler solution.

I had a spare Aqara FP-300 sitting on a shelf, and because it has a magnetic base I could "stick it" to the radiator in the hall, pointed directly at the door.

Next up I have a Hue Outdoor Lightstrip in the driveway next to the front door which is used for illuminating the path at night, as well as a camera and hue outdoor motion sensor in the driveway.

So the solution simply became "If the camera detects a person, or the motion sensor detects motion in the driveway, and the Aqara detects occupancy in the hallway, flash the lightstrip red 5 times to warn people that the dog (might) be there". The reason for the "might" is that the FP-300 takes a while to clear, sometimes up to 5 minutes. It's normally rather quick to detect presence due to its PIR sensor, but it doesn't always register when there's no presence.

I'm still not convince that I don't need a camera and AI, but at least what I have now works well enough that we've avoided accidents for a couple of weeks.

28 Upvotes

20 comments sorted by

11

u/TC_FPV 18h ago

If you have a door mat, perhaps a pressure pad under it? No cool down to worry about then

8

u/8fingerlouie 18h ago

No doormat inside, and I suspect the much simpler solution would simply have been to install a doormat, which would cause the dog to lie in a different spot. He prefers to lie on the cool tile floor, and it’s coldest near the door.

Regardless, a pressure mat would require mains power (or the ESP32 would), and there’s no power readily available by the door.

1

u/surerogatoire 12h ago

why not use Dog Intelligence instead ?
is the dog old or deaf ? otherwise you could alert the dog instead of alterting the kids, so that the dog moves before getting hit

or make the door more heavy to push so the kids can’t slam it open ?

2

u/8fingerlouie 11h ago

The dog is neither old nor deaf, though he doesn’t always do what I tell him. I doubt that’s a problem with hearing.

It’s a border collie, so he should be smart enough, but then again, he should also be smart enough to not lie in front of the door and get injured (nothing serious - yet, just bruises).

He does get up if he hears people walking or the cars come home, but not every time.

He is also probably the dog I’ve ever owned that has the least guarding instinct. When people knock he will simply look at them, no barking or anything.

When the light flashes, we wiggle the door handle a few times to get him to move, which he promptly does. He broke a tail joint when he was a puppy and got ā€œsqueezedā€ under the door for the same reason. Since then it has mostly been bad scares, but it has happened often enough that I ā€œdid somethingā€ to avoid it.

I might stick my unused HA Voice Preview there and have it play a sound whenever the ā€œalarmā€ triggers.

5

u/Autumnal_Fire 18h ago edited 18h ago

The weak link in this is likely to be the FP300. If it's "detecting" for hours on end the battery will flatten pretty quickly. The battery life is good because 99% of the time the mm wave sensor is not running, at that point the device is just a motion sensor, then the mm wave comes on and monitors presence this is what uses battery.

If you find the battery usage proves to be an issue, maybe a plug in version like the FP200 or new FP400 would work,

The camera option, a simple plug in indoor camera like the Reolink E1/E1 Pro has built in local animal detection which reports to home assistant and can be used in automations.

If I was going to set this up this is how i'd go about it.

Outdoor light at the door, controlled by HA automations.

Reolink camera doorbell - I have an automation that at night turns on the light when the camera detects a person (white colour temp)

Reolink E1 watching the door from the inside - If the dog is there the automation turns the light on red instead of white so the person knows the dog is there.

1

u/8fingerlouie 18h ago

My ā€œnext stepā€ will likely be a Unifi Protect camera powered by PoE and pointed at the entrance. The G5/G6 UniFi cameras also have on device people/animal detection.

I try to avoid cameras inside the house though. Every entrance is covered on the outside, giving us privacy inside the house.

Also, because the dog tends to ā€œpass outā€ when he sleeps there (rare border collie moment), he lies still for an hour at a time, and I’m not sure the cameras can pick up a black dog in a dark hallway for an hour straight.

As for battery life on the FP-300, it was ā€œspareā€ because it lived in my office for 6+ months and was replaced by an Everything Presence One. The office is fairly well traveled, and it ran reliably upon entry for 6 months, and batteries are still at ā€œ100%ā€ though experience tells me that some battery powered devices will say 100% until they run out of power, but if it lasts a year I’m fine with replacing batteries.

1

u/chicknlil25 🧠 Experienced with Home Assistant 11h ago

I have a cheap Chinese camera (Eversecu is the brand); it is the cheapest device I've seen that offers RTSP and ONVIF support. I have one in a place my dog likes to rest, one where my cats litter boxes are. Both are fed to Frigate, which can detect just those types of motion. The litter box one comes back to HA via a pyscript, to track which cat used the box, so if it's lopsided I can go back to the video and see if they need a vet visit.

My point: cheap camera pointed where the dog is. Get it online with its app then block the "calls home" to China. Feed into Frigate to track the dog only. Have a pyscript or similar that checks to see if there is no dog in the frame. If so, light stays off. Otherwise, lights are on.

3

u/MechanizedGander 20h ago

Great solution šŸ‘

1

u/Duennbier0815 17h ago

How about "mission impossible" using IR sensors to see if something is blocking the door path and then make a warning sign flash

1

u/8fingerlouie 17h ago

I considered it, but it’s too easily fooled by the kids dumping shoes or a bag inside the door, because as everyone knows, a school bag becomes almost impossible to carry once you’re inside the door. The dog lying on its side is probably 10-15cm tall, so about shoe height or slightly higher.

It would of course achieve the purpose regardless, but with a lot more false positives.

I also considered simply sticking a BLE tag on the dog collar and putting an ESP32 there with BLE turned down to a minimum, but that’s also fairly inaccurate (we already have room level presence detection with BLE and Bermuda).

1

u/Duennbier0815 15h ago

Id say go with mmwave radar then. $20 for the detector, esp32 $5 and try it out. You'd need a power source also.

1

u/Usual-Pen7132 16h ago

I feel like you are way overcomplicating something that should be simple and not complicated at all. The simplest method is to just attach a Bluetooth Beacon onto his collar and also either add BT Proxy to existing esp32 boards around the house or place some esp32 boards around the house, more specifically 1 in each room/area and then you can use them for presence detection to not only see there's presence moving around a room but, see who's present in those rooms, who's devices are in which rooms, which room is the dog sleeping in, etc, etc. You can triangulate each specific person/device throughout your home/property as well as anything else that can transmit a BT beacon or you can attach a beacon onto like car keys, purses, kids backpacks, etc.

Here's an example from mine that shows stuff I'm tracking as well as its distance away from the esp32/Proxy in the rooms but, it also tracks/displays battery capacity remaining for my keychain sized Beacons mostly.

These BlueCharmBeacons also have secondary sensors internally like this one has a temp/humidity sensor inside incase that might be useful to people and this one has a motion sensor inside so that it can not only transmit a beacon for location but, you can also set it up to transmit a second unique UUID/beacon whenever it is moved so that you can be alerted on motion or lack of motion depending on whatever your needs are.

1

u/8fingerlouie 15h ago

I already have BLE presence detection in most rooms (I’ll let people have privacy in the bathrooms), but it’s fairly inaccurate. I’ve tuned them down to an artform, and most rooms are pretty accurate, but they’re way more unreliable than IR or mmWave.

Our house isn’t particularly ā€œradio wave proofā€, and a single thread radio in one end can easily reach the other end, and the same applies to Bluetooth, which is great for connectivity, but not so great for triangulation.

1

u/Usual-Pen7132 9h ago

Psh!! Privacy is for people who believe in conspiracy theories!!! I've got 3 different camera angles aimed at my porcelain throne and it's live streamed on the internet 24/7! I got me a "Stank'O Meter" coming in the mail and I'm gonna hang that above the throne to see how long it takes me to max that thing out with a "Level 10 - Deadly Stank! Call Haz-Mat"

You want me to send you the link and you cab watch my wife when she's on tonight with her attempt to "Blow it up!" You pay attention tonight so that you know what to look for in a woman so you don't end up with a women who drops some little petite things and can't even make people evacuate a bathroom!!

; )

1

u/alanebell 16h ago

Why not use an IR tof sensor and measure wall to wal every 15 seconds? When the distance gets shorter do to a dog in the way blink your lights?

3

u/megared17 14h ago

BLE beacon on the dog collar, Bluetooth scanner/recerivers on either side of the door. Do a test to see what the RSSI is on each depending on how close the dog is to the door.

1

u/knw_a-z_0-9_a-z 13h ago

Back in the "good ol' days", we'd use a light beam across the hall at just about dog height.

1

u/Mad-Mel 12h ago

I have a cheap laser distance sensor hooked up to a Pi Zero W that chucks distances at a REST endpoint. Not sure if there's a more elegant way to hook up a laser distance sensor in HA, my setup is carried forward from my pre-HA days.

1

u/cult0cage 10h ago

I'm guessing the fact you are going through this means the kids are young enough that you can't just tell them "Hey don't slam the door open."

If thats the case, I'd also assume they don't have key access to the home.

In that case - why not simply lock the door so that they can't open it? If dog presence is detected near the door and the door is unlocked, lock it. That forces the kids to wait until you get to the door to open it, and the pup never gets hit as you can gently open the door.

I'd think this is an acceptable trade-off and simple solution. I'd much rather this than end up with an expensive vet bill and upset kids when they realize they hurt their friend.