Hack Doorbell ESP32

good afternoon. I have a doorbell that I wanted to make smart with Esphome. The system consists of 3 devices. The exterior device that has an electrical lock attached. a power transformer located in the electrical panel that converts 220V AC to 12V AC and powers the interior device, which is an intercom where the bell rings and the electric lock can be activated. In the interior device I wanted to add an Esp32 to activate the lock and receive information from the doorbell ring. The external device receives the electric lock on terminals C and D. Terminals A and B connect to terminals A and B of the internal device. the indoor device receives 12V AC at terminals 12~ and 0~. I want to install the Esp32 behind the interior module using 12V AC with a WMPC124. Could anyone help me with the electrical connections? thanks