This is a Python script that you can use in a microcontroller with a reed switch to text your phone when a door has been opened. I created this script to monitor my fridge door and alert me if it had been left open.
I ran this script on a Raspberry Pi that was connected to the reed switch. The switch was mounted on the side of the fridge near the handle of the door and the magnet for the switch was mounted on the door.
I used Telegram and the telebot library to send a message to my phone via SMS if the fridge was open for more than fine minutes.
Thank you for taking a look.