Code for my door sensor. Client and server.