No sign-up sheets.
Just message the bot.
LaundryBot turns university dorm laundry rooms into an automated, self-releasing booking system over Telegram. Select an available washer or dryer, set cycle minutes, and machines unlock automatically upon expiration. Zero double-bookings, zero server maintenance.
Operate the bot live. Watch the dorm fleet respond.
Tap the inline keyboard below to book a washer or dryer. The state machine validates availability, locks in remaining minutes, and mirrors live status onto the fleet board in real-time.
LaundryBot
Hello! Welcome to Dorm LaundryBot. What would you like to do? Pick a machine to book, check active reservations, or free a finished machine.
14:15Live Dorm Fleet Telemetry
Synchronized with local state (data/bookings.json)
Designed for durability. Sized for college dorms.
Clean architectural constraints: zero required port forwarding, atomic local data writes, and strictly serialized booking requests.
Zero Double-Bookings
In-memory dictionary lookups protect each machine. Concurrent requests for the same washer surface only vacant units, preventing slot collisions.
Long Polling via Port 443
Operates behind strict campus firewalls and residential NAT without requiring a static public IPv4, domain DNS setup, or incoming firewall exceptions.
Reboot-Resilient JSON
At 9 machines, an external SQL daemon adds needless moving parts. State is atomically written to data/bookings.json with boot pruning.
Automated Slot Freeing
Non-blocking asyncio tasks monitor remaining minutes. When the cycle completes, the bot unlocks the unit and updates JSON without manual intervention.
Runs on a $15 Raspberry Pi
Consumes ~32 MB of resident RAM. Deploys cleanly on a Raspberry Pi Zero 2W, an old dorm room laptop, or an unprivileged micro-container.
Local Tokens & Zero Tracking
Credentials reside in gitignored config.py. No resident telemetry, phone numbers, or metadata are shipped to external advertising servers.
From user tap to disk persistence.
Step-by-step propagation through Telegram MTProto cloud, python-telegram-bot async dispatcher, state machine, and JSON serialization.
Telegram MTProto
Student taps inline button inside Telegram iOS, Android, or Desktop client.
HTTPS OutboundPolling Receiver
Long poller retrieves update batches on port 443 without open ports.
PTB v22+Conversation FSM
Routes state: TYPE → MACHINE → DURATION.
Asyncio Coroutine
Schedules release timer coroutine to auto-unlock machine upon completion.
asyncio.create_taskAtomic JSON Disk
Persisted to data/bookings.json. Survives power loss and reboots.
Reboot Pruning Logic (app.py)
def load_bookings():
"""Load bookings from JSON file, discarding expired ones."""
global bookings
os.makedirs(DATA_DIR, exist_ok=True)
if not os.path.exists(BOOKINGS_FILE):
bookings = {}
return
try:
with open(BOOKINGS_FILE, "r") as f:
raw = json.load(f)
now = datetime.utcnow()
# Filter out expired bookings on boot
bookings = {
machine: data
for machine, data in raw.items()
if datetime.fromisoformat(data["end_time"]) > now
}
logger.info(f"Loaded {len(bookings)} active booking(s) from disk.")
except (json.JSONDecodeError, KeyError, ValueError):
bookings = {}
Manual paper chaos vs. conversational booking.
How a Telegram bot resolved dorm laundry disputes, neglected wet clothes, and conflicting sign-up sheets.
Sticky Notes & WhatsApp Disputes
Residents scribbled names on door paper sheets. Crossed-out times, laundry left in drums for hours, and repeated WhatsApp messages asking who owned which cycle.
images/before.png
Zoom
Paper sign-up sheet on laundry room entrance during the 2023 university semester.
Automated Telegram Conversation
Students open Telegram, pick an open washer or dryer, set minutes, and walk away. Units self-release when timers expire, and anyone can query /view instantly.
images/after.png
Zoom
Telegram conversation transcript showing keyboard interaction and slot confirmation.
Production host setup in 3 minutes.
Choose your host environment. Systemd background daemon, Docker Compose, or quick local execution on a student laptop.
/etc/systemd/system/laundrybot.service
[Unit]
Description=LaundryBot Telegram Daemon
After=network.target
[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/LaundryBot
ExecStart=/home/pi/LaundryBot/venv/bin/python app.py
Restart=always
RestartSec=10
Environment=PYTHONUNBUFFERED=1
[Install]
WantedBy=multi-user.target
Command specifications & FAQ.
Detailed behavior for every Telegram command and dorm operational edge cases.
| Command | Scope | Action |
|---|---|---|
| /start | Entrypoint | Launches guided booking dialogue. Displays Washer vs Dryer keyboard. |
| /view | Global Read | Lists all 9 machines with active bookers and live remaining minutes. |
| /free | Releases Unit | Early machine unlock before timer completes. Updates JSON immediately. |
| /cancel | State Abort | Interrupts ongoing conversation, cleans draft state, returns to IDLE. |
| /help | Info | Explains dorm guidelines, detergent etiquette, and operational rules. |
Can two people book the same machine?
No. When a machine is booked, it is dynamically removed from subsequent keyboards and rejected by mutual exclusion checks in Python.
What happens if the host machine restarts?
State is saved to data/bookings.json. On restart, the bot reloads active bookings and automatically discards timers that expired while offline.
Why Long Polling instead of Webhooks?
Campus networks block inbound ports. Long polling initiates outbound connections to Telegram on port 443, functioning behind any university NAT without reverse proxies.
Can it integrate with physical vibration sensors?
Yes. Flask is included in requirements.txt, enabling simple HTTP webhooks for ESP32 vibration or CT power clamp sensors.
Deploy LaundryBot in your student residence.
Fork the code on GitHub, paste your Telegram token from @BotFather, and launch the service in minutes. Open source under the MIT License.