So I have searched for a door look sensor but couldn't find a good solution so I made one of a microswitch and a nexa remote I had laying around. However the remote broke and I had to use something else, like this magnetic sensor which is supposed to have a on or off activated constantly. This was my first idea but I didn't have one laying around.
Step 1: The Sensor
To open the sensor remove the sticker on the back and remove the screw and bend it open.
The white arrow points on the actual magnetic sensor, this is where you want to attach your microswitch.
On the third picture you can see the delay controller and in order to have the sensor send a signal without a delay you need to short the 4 marked points to the upper right in the picture. See picture 4.
Step 2: Microswitch and Mounting
Now attach the microswitch on each side of the sensor. when the microswitch is closed it should short the circuit.
As you can see I was able to put the whole thing in my door lock, however once the door was closed the signal couldn't be reached, so I had to attach an antenna, and I just guessed and attached a wire to point marked in yellow. The antenna is then routed to the inside of my apartment as you can see in the last picture.