A complete IoT Building Management System with remote OTA firmware updates, real-time monitoring, and secure MQTT communication. Monitor temperature, humidity, and environmental sensors using ESP32 nodes - update them wirelessly without physical access!
- Real-time temperature, humidity, and dew point readings
- Support for multiple ESP32 sensor nodes
- WiFi signal strength monitoring
- Auto-refresh monitoring dashboard
- TLS-encrypted MQTT connections (port 8883)
- Certificate-based authentication
- Access control lists (ACL)
- User authentication for web interface
- Node management interface
- Live sensor monitoring with auto-refresh
- Real-time charts (temperature & humidity history)
- Historical data viewing
- Responsive design
- RESTful API for node management
- Public API for sensor data (no auth required)
- WebSocket support for real-time updates
- JSON-based data exchange
- Remote firmware updates for ESP32 nodes
- Upload .bin files via web interface
- One-click OTA trigger for any node
- Real-time update progress monitoring
- Firmware version tracking
- No physical access needed after initial setup
- Update multiple nodes sequentially
- One-command setup script
- Docker Compose orchestration
- Auto-generated ESP32 Arduino code
- Automatic TLS certificate generation
- Docker Desktop installed
- 2GB RAM minimum
- Network access for ESP32 nodes
-
Clone the repository
git clone <your-repo-url> BMS-server cd BMS-server
-
Run setup script
./setup.sh
-
Access the system
- Web Interface:
http://<SERVER_IP>:8080 - Login with credentials you created during setup
- Web Interface:
-
Add sensor nodes
- Click "Add Node" in the web interface
- Get auto-generated ESP32 code with TLS certificate
- Flash to your ESP32 device (first time only via USB)
-
Update firmware remotely (Optional)
- Go to Firmware tab
- Upload new .bin file
- Click OTA button on any node
- Watch it update wirelessly! π
That's it! π
βββββββββββββββ
β ESP32 Nodes β β OTA Updates (WiFi)
ββββββββ¬βββββββ
β MQTT/TLS (8883)
β
ββββββββββββββββββββ
β Mosquitto Broker β
ββββββββββ¬ββββββββββ
β
β
βββββββββββββββββββ ββββββββββββββ
β Node.js API βββββββ PostgreSQL β
β (Port 3000) β β Database β
ββββββββββ¬βββββββββ ββββββββββββββ
β
β
βββββββββββββββββββ
β Web Dashboard β
β (Port 8080) β
βββββββββββββββββββ
- MQTT Broker: Eclipse Mosquitto with TLS
- Database: PostgreSQL 15
- API Server: Node.js with Express
- Web Frontend: Vanilla JS + HTML/CSS
- Sensor Nodes: ESP32 with Arduino
# Get all active sensors
curl http://<SERVER_IP>:3000/api/public/sensors
# Get specific sensor data
curl http://<SERVER_IP>:3000/api/public/sensors/node_1GET /api/nodes- List all nodesPOST /api/nodes- Create new nodeGET /api/nodes/:id/data- Get sensor dataPOST /api/firmware/upload- Upload firmwarePOST /api/nodes/:id/ota-update- Trigger OTA update- More in DEPLOYMENT.md
-
QUICKSTART_OTA.md - 5-minute OTA update guide
- Quick setup for remote firmware updates
- Step-by-step instructions
- Troubleshooting tips
-
OTA_GUIDE.md - Complete OTA documentation
- Detailed OTA setup & workflows
- Building firmware binaries
- Best practices & security
- API reference
-
DEPLOYMENT.md - Complete deployment guide
- Manual setup instructions
- Troubleshooting
- Docker commands
- Security notes
- Backup procedures
-
examples/ - ESP32 example sketches
- OTA version (with remote update support)
- TLS version
- Simple version (no TLS)
- SHT10 sensor integration
- Any computer with Docker support
- 2GB RAM minimum
- Network connectivity
- ESP32-S3 or compatible
- SHT10/SHT11 temperature & humidity sensor
- WiFi connectivity
SHT10 DATA β ESP32 GPIO 10
SHT10 SCK β ESP32 GPIO 11
SHT10 VCC β 3.3V
SHT10 GND β GND
BMS-server/
βββ api/ # Node.js API server
β βββ server.js # Main API with OTA endpoints
β βββ package.json
βββ web/ # Web frontend
β βββ index.html # Dashboard with Firmware tab
β βββ app.js # Frontend logic
β βββ styles.css
βββ mosquitto/ # MQTT broker config
β βββ config/ # Configuration files
β βββ certs/ # TLS certificates
β βββ data/ # Persistent data
βββ firmware/ # Uploaded firmware storage
βββ examples/
β βββ esp32_sht10/ # Standard TLS sketch
β βββ esp32_sht10_ota/ # OTA-capable sketch β
βββ docker-compose.yml
βββ setup.sh # Automated setup
βββ DEPLOYMENT.md # Deployment guide
βββ OTA_GUIDE.md # Complete OTA documentation
βββ QUICKSTART_OTA.md # 5-minute OTA guide
# Build all containers
docker-compose build
# Start services
docker-compose up -d
# View logs
docker-compose logs -fContributions welcome! Please feel free to submit pull requests or open issues.
See LICENSE file for details.
| Feature | Status | Description |
|---|---|---|
| π‘οΈ Sensor Monitoring | β | Real-time temperature, humidity, dew point |
| π Web Dashboard | β | 3 tabs: Nodes, Monitor, Firmware |
| π Live Charts | β | Temperature & humidity history graphs |
| π TLS Encryption | β | Secure MQTT on port 8883 |
| π OTA Updates | β | Remote firmware updates via web UI |
| π Public API | β | No-auth sensor data endpoint |
| π Authentication | β | JWT-based user authentication |
| π³ Docker Deploy | β | One-command setup script |
| π± Auto-Generated Code | β | ESP32 sketch with credentials |
| πΎ Data Persistence | β | PostgreSQL with historical data |
# 1. Build your firmware in Arduino IDE
# 2. Upload via web interface (Firmware tab)
# 3. Click OTA button on node
# 4. Done! Node updates and reboots automaticallyNo more climbing ladders to update sensors! πͺβ
- β ESP32-S3 DevKit
- β SHT10/SHT11 sensors
- β Docker on macOS/Linux/Windows
- β OTA updates over WiFi
- Check DEPLOYMENT.md for troubleshooting
- Review OTA_GUIDE.md for OTA issues
- Docker logs:
docker-compose logs - ESP32 Serial Monitor: 115200 baud
OTA not working?
- Ensure ESP32 is running OTA-capable firmware
- Check Serial Monitor for "ESP32-S3 BMS Node with OTA"
- Verify node is subscribed to command topic
Can't upload firmware?
- Hard refresh browser (Ctrl+Shift+R)
- Check file is .bin format
- Max file size: 10MB
Node not connecting?
- Verify MQTT credentials
- Check TLS certificate is loaded
- Ensure WiFi is connected
Made with β€οΈ for IoT and Building Automation
Repository: https://github.com/hamedtorky/BMS