Some community members have done this with a contact sensor and a microswitch. You can either use a sensor based on the position of the deadbolt on the door or embed one into the door jam so you can tell when the bolt is extended. ![]()
You can see discussion of these ideas in the following thread. The thread is old, but the same concepts would apply.