I did something similar to this except I used a pressure sensor that I installed in the door frame so the bolt would contact it when the deadbolt was locked. The issue I ran into is in the afternoon the heat causes the sensor to not respond reliably. Pressure/Force Sensitive Resister and a door sensor, Works!
I’m going to have to try this method instead and re purpose the ecolink sensor to monitor my condensate pump