Guides › Door-left-open alert
🚪 Door-left-open alert
“Can my phone warn me when the back door is left open?”
The simplest useful build there is: a magnet on the door, a reed switch on the frame, and a small WiFi board that warns your phone if the door stays open for more than a few minutes.
What to buy
| Part | Why this one | Rough cost |
|---|---|---|
| ESP32-C3 board (e.g. Seeed XIAO ESP32C3) | Small, cheap, WiFi built in. | $4–7 |
| Magnetic reed switch, door/window type, with magnet | A switch that closes when the magnet is near (door shut) and opens when the door opens. | $1–3 |
| Two wires and USB power | The switch goes between one pin and ground. | $1 |
Prices are rough ranges, not quotes. Check the current price and stock before you order.
What to install
With Home Assistant: in ESPHome, the switch is a sensor with a delay filter, so “open for 5 minutes” triggers the alert and a quick trip outside doesn't. Home Assistant sends the phone notification.
Without: a short Arduino sketch notes when the door opened and, if it's still open 5 minutes later, posts to ntfy. Send one more message when it closes.
Build it in three steps
- Wire the switch. One wire to a pin, one to ground. Turn on the pin's internal pull-up (a built-in resistor that holds the pin high until the switch pulls it low). Print open/closed as you move the magnet.
- Add the timer. Alert only after the door has been open for a set time; 5 minutes is a good start.
- Mount it. Switch on the frame, magnet on the door, lined up and close together when the door is shut.
What catches people out
- The gap matters. Most reed switches only work with the magnet within about 1–2 cm. Test the gap before fixing anything in place.
- Steel frames weaken the magnet. Try it first, or use a stronger magnet or a spacer.
- Contacts bounce. A closing door rattles the switch. Ignore changes shorter than about 50 ms.
- Battery version later. The board can deep-sleep and wake when the door opens, but on the ESP32-C3 only GPIO 0–5 can wake it. Get the USB version working first.
Your version is different?
Ask IotMentor with your own details: distance, power, budget, experience. It asks a few questions back, then gives you a plan like this one, free.
Ask IotMentorStarts with: “Can my phone warn me when the back door is left open?” Add your own details before you send it.