IoT Door Sensor Platform with Real-Time Alerts with Deep Sleep Architecture

Full-stack IoT monitoring platform delivering instant door status alerts with multi-year battery operation. Event-driven MQTT architecture, HTTP API device configuration, and multi-channel alert delivery.

MQTT
Real Time Protocol
Multi – Year
Battery Operations
3 Channels
SMS,Call,Email
HTTP API
Remote Configuration

The Challenge

Battery life was blocking deployment at scale.

The client needed to deploy IoT door sensors across a distributed user base. Users required instant alerts when doors opened or closed. Two technical constraints determined platform architecture: devices needed multi-year battery life to eliminate regular maintenance visits, and had to maintain server communication while operating in deep sleep mode.

Every consumer IoT solution on the market failed on battery economics. Devices drained power within months, requiring regular site visits to swap batteries. For deployments at scale, this maintenance overhead destroyed unit economics. The requirement was clear: build an IoT infrastructure capable of multi-year operation without human intervention while maintaining continuous, real-time communication.

Off-the-shelf cloud platforms couldn't meet the requirement. Most relied on polling architectures that kept radios active, draining batteries. Vendor-locked ecosystems offered no control over alert routing, device configuration, or data ownership.

Before and After

From quarterly battery changes to multi-year operation.

Platform deployment eliminated scheduled maintenance, enabled remote device configuration, and delivered alerts through user-configured channels rather than forcing a single notification method.

Before Platform
Quarterly battery replacement schedule
On-site technician visits for configuration
Single-channel alert delivery
No real-time device health monitoring
Manual device provisioning process
After Deployment
Multi-year battery operation achieved
Remote HTTP API device configuration
Multi-channel: SMS, phone call, email
Deep sleep heartbeat monitoring
Web and mobile app onboarding
Technical Architecture

Event-driven architecture from device to delivery.

Platform built on MQTT publish-subscribe messaging, HTTP API device management, multi-language backend stack, and responsive frontend for web and mobile.

Hardware Selection: Shelly Door-Window 2
Selected ShellyDW2 (Gen 1 IoT door sensor) as initial deployment device. Key selection criteria: developer-configurable MQTT communication, HTTP REST API for remote settings management, deep sleep capability with maintained server connection. Device specifications: Wi-Fi connectivity, magnetic reed switch for door state detection, battery-powered operation with programmable sleep intervals.
Communication Layer: MQTT Protocol
Deployed Mosquitto MQTT message broker on Ubuntu OS. MQTT's publish-subscribe architecture suited low-power devices: devices wake on door state change, publish message to broker, return to sleep. Active transmission time measured in milliseconds. Username/password authentication per device with optional TLS for production. Devices configured with broker IP, port, and credentials via HTTP API.
Backend Services
Multi-language stack optimized per layer. Node.js handled API services and frontend requests. Python processed MQTT events, applied alert routing logic, and integrated with third-party SMS, voice, and email APIs. MySQL stored user accounts, device metadata, alert configurations, and event logs. Architecture designed for per-user alert preferences: SMS only, call only, email only, or any combination.
Frontend Application
Built with Angular for web interface and mobile application. Users onboard devices via QR code scanning or manual entry, assign human-readable names, configure alert preferences, view device health status, and share access with family members. Device health dashboard displays last-seen timestamps for each sensor, tracking deep-sleep heartbeat status without active polling.
SHELLY DW2 MQTT 3.1.1 MOSQUITTO NODE.JS PYTHON ANGULAR MYSQL HTTP REST API UBUNTU
Platform Interface

Live device monitoring.
Real-time status streaming.

Admin dashboard displays real-time device status, battery levels, door states, and last-seen timestamps. Live log streaming shows periodic heartbeat updates from devices in deep sleep mode.

CXAlerts Platform Dashboard - Live Logs Streaming

CXAlerts platform dashboard showing live device status streaming. Each entry displays Device ID (Shelly DW2 model identifier), battery level (100% indicates full charge), door state (open/close), and last update timestamp. Periodic heartbeat updates from devices in deep sleep mode confirm connectivity without draining battery.

System Architecture

End-to-end platform architecture.

Complete technical stack from IoT device layer through communication protocol, backend services, frontend interface, to multi-channel alert delivery.

LAYER 1 · HARDWARE LAYER 2 · MESSAGING LAYER 3 · BACKEND LAYER 4 · FRONTEND LAYER 5 · ALERTS Shelly DW2 Gen 1 Door Sensor Wi-Fi · Deep Sleep Shelly DW2 Gen 1 Door Sensor Wi-Fi · Deep Sleep Shelly DW2 Multi-vendor support HTTP API Config Mosquitto MQTT Broker Publish-Subscribe Messaging Protocol UBUNTU OS · MQTT 3.1.1 · USERNAME/PASSWORD AUTH Node.js API Server Express · RESTful Frontend Requests Python MQTT Handler Paho MQTT Client Alert Logic MySQL Database User Accounts Device Metadata Angular Web App Device Management User Configuration Mobile App QR Code Onboarding Alert Preferences SMS Alerts Third-party API Twilio Integration Voice Call Alerts Automated Calls Plivo Integration Email Alerts SMTP Delivery SendGrid API MQTT Publish Message Subscribe Alert Dispatch HTTP API Configuration

Complete system architecture showing five layers: IoT hardware (Shelly DW2 sensors with deep sleep), MQTT messaging infrastructure (Mosquitto broker), backend services (Node.js API, Python event handler, MySQL database), frontend interfaces (Angular web and mobile applications), and multi-channel alert delivery (SMS, voice call, email). Configuration flow via HTTP API shown on right.

Implementation

From device provisioning to live deployment.

Structured onboarding workflow designed to minimize manual configuration and enable remote device management.

Device Provisioning: Each Shelly DW2 pre-configured via HTTP API with MQTT broker credentials (IP address, port, username, password) and assigned unique device ID before deployment. Settings configured remotely without physical access.

User Account Creation: End users created accounts via web or mobile app, entered location details, set initial alert preferences (SMS, call, email, or combinations).

Device Pairing: Users scanned device QR codes or entered device IDs to link sensors to their accounts. Assigned human-readable names for easy identification.

Testing and Validation: Each paired device transmitted test event to confirm end-to-end connectivity—from sensor to MQTT broker to backend to alert delivery across selected channels.

Live Monitoring: Once validated, devices entered operational mode. All door events triggered alerts per user preferences. Deep sleep heartbeat updates confirmed device health without manual checks.

Remote Configuration Capability: HTTP API access eliminated need for physical device access. Settings changes, troubleshooting, and updates performed remotely from backend without dispatching technicians to client locations.
Technical Decisions

Why these technologies.
Not alternatives.

Each architectural choice addressed specific operational constraints. Event-driven messaging preserved battery life. Self-hosted infrastructure maintained control. Multi-channel delivery matched user behavior.

MQTT Over HTTP Polling: MQTT's publish-subscribe model meant devices only transmitted data when events occurred or on scheduled heartbeat intervals. HTTP polling would have required devices to check for updates repeatedly, consuming battery even when no events occurred. Event-driven architecture preserved battery life while maintaining real-time responsiveness.

Self-Hosted MQTT Broker: Running Mosquitto on owned infrastructure gave full control over message routing, data retention, and device management. Vendor cloud platforms would have limited control over alert logic, introduced third-party dependencies, and increased operational costs at scale.

Multi-Channel Alert Support: Different users have different notification preferences. Some need immediate phone alerts for critical access points. Others prefer silent email logs for non-urgent monitoring. Supporting SMS, call, email, and combinations meant the platform adapted to user behavior rather than forcing users to adapt to platform limitations.

HTTP API Configuration: Remote device configuration via HTTP API eliminated need for physical access to deployed sensors. Settings changes, troubleshooting, and updates could be performed from backend without dispatching technicians to client locations.

Deployment Outcomes

Operational IoT at scale.

Platform deployed successfully across distributed user base with measurable operational improvements in battery life, alert delivery speed, and maintenance overhead.

Multi-Year Battery Operation
Deep sleep mode reduced active power draw to near-zero between events. Field-deployed devices exceeded 18-month battery life with no degradation in responsiveness, eliminating planned quarterly battery replacement schedule.
Sub-Second Alert Delivery
MQTT event-driven architecture meant door status changes transmitted the moment they occurred. Users received SMS, voice, or email alerts within 1-2 seconds of door opening—fast enough for real-time security monitoring.
80% Reduction in Operational Overhead
Pre-configuration and remote device management via HTTP API eliminated on-site technician visits for device setup, battery replacement, and configuration changes. Operations previously requiring field teams now executed from dashboard.
User-Configured Alert Delivery
Per-user alert preferences (SMS, call, email, or combinations) resulted in higher alert response rates compared to single-channel notification systems. Users configured notifications matching their requirements rather than adapting to platform constraints.
Key Takeaways

What this means for operations.

Lessons for CXOs evaluating IoT deployments: battery economics, protocol selection, infrastructure control, and user preference flexibility.

Battery Economics Determine IoT Viability: Deep sleep mode isn't optional—it's the difference between a deployable product and an operational tax. Multi-year battery life eliminates maintenance overhead that destroys unit economics at scale.

Event-Driven Architectures Outperform Polling: MQTT's publish-subscribe model delivered sub-second alerts with multi-year battery life. Protocol-level optimization matters when building for real-time response with power constraints.

Vendor-Agnostic Infrastructure Reduces Risk: Self-hosted MQTT and HTTP API control mean no dependency on third-party cloud platforms that can change terms, raise prices, or shut down. Operational ownership matters.

Multi-Channel Alerts Increase Engagement: Users who configured their own notification preferences—SMS, call, email, or combinations—showed higher response rates than single-channel systems. Platforms should adapt to user behavior, not force behavior change.

Remote Management Eliminates Site Visits: HTTP API configuration capability allowed team to troubleshoot, update, and manage hundreds of devices from dashboard. 80% reduction in operational overhead came from eliminating physical access requirements.

Need an IoT platform that actually works at scale?

We build full-stack IoT systems with the operational characteristics your deployment actually needs. Battery life. Real-time response. Infrastructure you control.