Prototype contact sensor for sliding patio door LOCK

This post is about a prototype non-magnetic contact sensor for a sliding patio door LOCK.

The sliding door and lock I'm working with are pictured in post #1.

The first picture shows all of the parts:

I took a Tuya water leak sensor that included a cable to a pair of electrodes, cut the cable down to expose two wires, and soldered the wires to the terminals of a micro-switch. A bit of shrink-wrap tubing added for aesthetics (improved WAF).

The switch is glued to a cut-down tongue depressor (needs to be thin to fit the door channel such that the sliding door closes fully).

A bit of cut-down pencil with an O-ring glued to it as a stop fits in the lock channel. The lock mechanism pushes upwards on the eraser end when the door is locked sufficiently to change the switch state.

3M Command strips are used on the back of the tongue depressor and in the door channel to allow adjustable positioning of the switch. The sensor was going to be set up the same way BUT the 2 layers of strips was too thick, so I used a single thin 3M poster mount strip.

The mounted sensor and switch are shown in the second image:

This works better than the magnetic prototype in post #1 because the switch opens and closes at the same physical point and the sensor changes state when the door is unlocked but not opened (the magnetic prototype had to be unlocked AND opened for the magnetic contact sensor to indicate OPEN).

To avoid using "wet" and "dry" states in my rules, I changed the driver to "Generic Zigbee Contact Sensor (no temp)". Accordingly, I now get "open" and "closed" states.

HOWEVER, I connected the Common and Normally_Open terminals of the switch to the leak sensor, which means the sensor state is WET (which translates as OPEN in the contact sensor driver) when the door is closed, and DRY (which translates as CLOSED) when the door is open. Fortunately, I have a second sensor and many more microswitches, so I'll correct the error by building a 2nd unit using the Common and Normally_Closed terminals. I'm also likely to paint the wood portion and the switch white for even better WAF.