ESP32-C3 Super Mini based door lock sensor using a reed switch. Reports lock state to Home Assistant via MQTT auto-discovery.
- ESP32-C3 Super Mini
- Reed switch (N/O, normally open)
- Magnet (mounted on lock bolt)
ESP32-C3 Super Mini Reed Switch
─────────────────── ──────────
GPIO3 ──────────────────── Pin 1
GND ──────────────────── Pin 2
Internal pullup enabled — no external resistor needed.
| Magnet | Switch | GPIO | State |
|---|---|---|---|
| Present | Closed | LOW | LOCKED |
| Absent | Open | HIGH | UNLOCKED |
-
Install PlatformIO
-
Copy the sample config and fill in your credentials:
cp include/config.sample.h include/config.h
-
Edit
include/config.hwith your WiFi and MQTT broker details -
Build and flash:
pio run -t upload
-
Monitor serial output:
pio device monitor
The sensor registers itself in Home Assistant automatically via MQTT discovery.
├── platformio.ini # PlatformIO config
├── src/
│ └── main.cpp # Firmware: WiFi + MQTT + reed switch
├── include/
│ ├── config.sample.h # Template config (tracked)
│ └── config.h # Your config with credentials (gitignored)
├── RESEARCH.md # Hardware research notes
└── BOM-ALIEXPRESS.md # Bill of materials
- Deep sleep with GPIO wakeup for battery operation
- Battery voltage monitoring via ADC
- OTA firmware updates
- Multiple sensor support
MIT