There’s a moment every evening, right as the sun drops below the tree line, when I find myself asking the same question: are all the chickens inside?
It’s a simple problem with annoying timing. Too early, and you lock someone out. Too late, and you’re inviting every predator in the county to dinner. For months, I’ve been walking out at dusk, counting heads, and manually closing the door. It works, but it doesn’t scale—especially when I’m traveling or just want to trust the system.
So I taught my AI to do it.
The Setup
The hardware is already in place:
- A UniFi camera inside the coop with a 4K view of the run and door
- An Omlet Eglu coop with an automatic door connected via their API
- My AI assistant (Clawdbot), running on a Mac Mini in my office
- 8 Rhode Island Reds who are, admittedly, super cute
The missing piece was the logic: how do you know when all the chickens are inside?
How It Works
Here’s what we built:
- ~15-30 minutes after sunset: A cron job kicks off and starts checking the camera feed
- Capture snapshot: Count chickens still outside
- Doorway check: My girls sometimes like to perch in the doorway before committing to bedtime. If anyone’s blocking the door, wait and check again in a few minutes
- All clear: When 0 chickens are outside and the doorway is clear, trigger the door close via the Omlet API
- Notify me: Send a confirmation when it’s done (or alert me if someone’s being stubborn for too long)
The AI pulls sunset times automatically for my location and kicks off the check sequence each evening.
Counting Chickens (Literally)
The UniFi camera gives me a solid view of the run and the door area. From testing today, I can clearly see the birds when they’re outside, and the camera angle makes it easy to spot anyone lingering in the doorway.
I’m using computer vision to count the chickens in each frame. As long as I can reliably tell “some outside” from “0 outside,” we’re in business. The doorway-perching behavior is the tricky edge case—I don’t want to close the door on anyone’s tail feathers.

What’s Next
The cron job is now running every evening, and the system is live. The first few nights have gone smoothly—all 8 girls tucked in safely without me lifting a finger.
How I did it
Clawdbot is really incredible. I talk to it like a person on signal. I told it I wanted help automating my chicken coop door.
First I gave Clawdbot the RTSP stream to the camera. It could immediately see and interact with my camera and I was amazed that it grabbed the current chicken count and breed.


I asked it to test the API, and about fell off my chair when it not only closed the chicken coop door, but conformed it was closed from both the API AND the camera!
What’s Next?
Future improvements I’m thinking about:
- Individual chicken identification (yes, really—they do have distinct personalities)
- Anomaly detection (sick bird? unusual behavior?)
- Weather integration (close earlier if a storm’s coming)
For now, the goal is simple: keep the girls safe without me having to trudge out in the snow every night. Mission accomplished. 🐔




