📡 API Endpoints (all routes)
20 entries — same backend as app.py. Scroll this panel if the table is tall.
| Method |
Endpoint |
Description |
| GET |
/ |
Dashboard page |
| GET |
/diagram |
Architecture diagram page |
| GET |
/api/docs |
Swagger UI (interactive API docs) |
| GET |
/api/sensor |
Simulated sensor reading |
| POST |
/api/v1/sensors/register |
Register sensor device |
| POST |
/api/v1/sensors/data |
Submit lux sensor reading |
| GET |
/api/v1/sensors/{sensor_id}/status |
Sensor status by ID |
| GET |
/api/v1/sensors/latest |
Latest lux from daily_usage |
| POST |
/api/usage/save |
Save daily usage |
| GET |
/api/usage/{date} |
Get usage for date |
| GET |
/api/usage/statistics |
Weekly and monthly stats |
| POST |
/api/room/{room}/save |
Save room usage |
| GET |
/api/room/{room}/{date} |
Get room data for date |
| GET |
/api/room/{room}/statistics |
Room weekly and monthly stats |
| GET |
/api/rooms/all/{date} |
All rooms for date |
| POST |
/api/admin/access |
Log admin access |
| POST |
/api/alerts |
Create long-on alert |
| POST |
/api/user/login |
User login (email and password) |
| POST |
/api/feedback |
Report an issue |
| POST |
/api/device/log |
Log device when lights turn on |
📊 Screen Layout Overview
📅 Sidebar (Left)
• Time & Date (Configurable Timezone)
• Calendar (Sun-Sat)
• Donut Chart
• Warning Notification
• Room Usage Bars
• Brightness %
🎛️ Main Area
• 2 Room Controls
• Gauge (0-800 lux)
• Brightness Slider
• Weekly Line Graph
• Eco/Sleep Modes
📈 Statistics
• Today's Usage
• Monthly Usage
• Progress Bars
• Live Updates
📦 Data Structure (MongoDB Collections)
dateString
sensor_idString
onSecondsNumber
offSecondsNumber
updatedAtDateTime
dateString
sensor_idString
onSecondsNumber
avgLuxNumber
dateString
sensor_idString
onSecondsNumber
avgLuxNumber
action_typeString
room_idString
room_nameString
dateString
timeString
ipString
userAgentString
createdAtDateTime
usernameString
accessedAtDateTime
ipString
userAgentString
pathString
textString
dateString
timeString
timestampDateTime
createdAtDateTime
alert_idString (UUID)
room_idString
dateString
durationSecondsNumber
typeString
createdAtDateTime
🔄 Data Flow
👤 User
Actions
→
🖥️ Frontend
JS/HTML
→
⚙️ Backend
Flask API
→
🗄️ MongoDB
Atlas Cloud
📊 Daily Usage Analytics
📈 Monthly Usage Analytics (Live)
🍃 MongoDB Atlas Database
Access the cloud database to view stored data and collections.
🍃
Open MongoDB Atlas Dashboard
↗
🔒
Read-Only Access - Data viewing only, modifications are restricted