If you’re interested in doing a chicken coop, there is already a pre-packaged product created by a community member for a chicken coop. It’s called Coop boss. It won a SmartThings contest for most creative project about two years ago.
For a chicken coop, you typically need a number of additional features, including object detection so you don’t shut the door on a chicken!
Check this out:
Here’s the product site:
And here’s the original development thread: