Skip to content

kavix/elektrum

Repository files navigation

โšก Elektrum - Home Energy Dashboard

Where Energy Meets Intelligence

Real-time energy monitoring system with predictive analytics, room-wise consumption tracking, and smart billing integration for Sri Lankan homes.


โœจ Key Features

๐Ÿ“Š Real-Time Monitoring

  • Live power consumption tracking (Watts)
  • Voltage and current monitoring
  • Temperature & humidity sensors
  • 5-second data refresh intervals
  • 24-hour historical data

๐Ÿ  Room-Wise Analytics

  • Individual room power consumption tracking
  • Current (Amperes) and power (Watts) breakdown
  • Average and peak power metrics
  • Visual power distribution pie charts
  • Room-specific consumption percentages

๐Ÿค– Predictive Analytics

  • Ridge Regression time-series forecasting
  • Consumption pattern analysis
  • Daily/weekly/monthly trend predictions
  • Real-time model status indicator

๐Ÿ’ก Smart Reports & Billing

  • PDF Report Generation: Weekly and monthly summaries
  • Bill Integration: Quick links to CEB and LECO payment portals
  • Cost Estimation: Daily, monthly cost calculations (โ‚น13.06/kWh default)
  • Carbon Tracking: Monthly COโ‚‚ footprint calculations in kg

๐Ÿ“ˆ Visualizations

  • 24-hour usage pattern charts
  • Power consumption by room (bar charts)
  • Power distribution pie charts
  • System status monitoring
  • Real-time data points counter

๐Ÿ”Œ Connected Systems

  • MongoDB for historical data storage
  • IoT sensor integration
  • Active connection status indicator
  • Scalable architecture

๐Ÿ› ๏ธ Tech Stack

Layer Technology
Frontend React, Tailwind CSS, Chart.js
Backend FastAPI, Python
Database MongoDB
IoT/Sensors Real-time energy sensors
Data Processing Ridge Regression, Time-series analysis
Deployment Vercel & AWS EC2

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 16+
  • Python 3.9+
  • MongoDB instance
  • IoT energy sensors/smart meters

Frontend Setup

# Install dependencies
npm install

# Start development server
npm start

# Build for production
npm run build

Backend Setup

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Start FastAPI server
uvicorn main:app --reload

Environment Variables

# Frontend (.env)
REACT_APP_API_URL=http://localhost:8000

# Backend (.env)
MONGODB_URI=mongodb://localhost:27017
DATABASE_NAME=elektrum
SENSOR_UPDATE_INTERVAL=5

๐Ÿ“‹ Project Structure

elektrum/
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Dashboard.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ RoomConsumption.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Charts.jsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ BillPayment.jsx
โ”‚   โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ””โ”€โ”€ App.jsx
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”œโ”€โ”€ sensor.py
โ”‚   โ”‚   โ””โ”€โ”€ room.py
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ”œโ”€โ”€ energy.py
โ”‚   โ”‚   โ”œโ”€โ”€ analytics.py
โ”‚   โ”‚   โ””โ”€โ”€ reports.py
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ prediction.py
โ”‚   โ”‚   โ””โ”€โ”€ pdf_generator.py
โ”‚   โ””โ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

๐ŸŽฎ Usage

View Real-Time Metrics

  • Dashboard displays live power consumption, voltage, temperature, and humidity
  • Auto-refreshes every 5 seconds
  • Filter data by time range (1h, 6h, 24h, 7d)

Monitor Room Consumption

  • Check individual room power usage
  • Compare current, average, and peak consumption
  • Identify high-usage rooms instantly

Generate Reports

  • Click "Weekly Report" or "Monthly Report"
  • Includes consumption breakdown, daily stats, costs, and carbon footprint
  • PDFs ready for download

Pay Bills

  • Quick links to CEB (Ceylon Electricity Board) and LECO payment portals
  • Estimated monthly bill based on consumption
  • Accurate rate calculations

๐Ÿ“Š Predictions & Analytics

The system uses Ridge Regression for time-series forecasting:

  • Analyzes historical consumption patterns
  • Predicts future energy usage
  • Helps identify optimization opportunities
  • Real-time model status display

๐ŸŒ Sri Lanka Specific Features

  • Billing Integration: Direct links to CEB and LECO portals
  • Local Pricing: Default rate โ‚น13.06/kWh (configurable)
  • Carbon Footprint: Monthly COโ‚‚ tracking in kg
  • Multi-Language Support: Ready for Sinhala/Tamil translation

๐Ÿ“ˆ API Endpoints

Energy Data

  • GET /api/energy/current - Current power metrics
  • GET /api/energy/history?room=&range=24h - Historical data
  • POST /api/energy/log - Log sensor reading

Analytics

  • GET /api/analytics/predict?days=7 - Predict next 7 days
  • GET /api/analytics/patterns - Get consumption patterns
  • GET /api/analytics/carbon-footprint - Monthly COโ‚‚ data

Reports

  • POST /api/reports/generate?type=weekly - Generate PDF
  • GET /api/reports/estimated-bill - Calculate estimated cost

๐Ÿ”ฎ Future Enhancements

  • Smart device integration (IoT appliance control)
  • Mobile app (React Native/Flutter)
  • Machine learning optimization suggestions
  • Solar panel integration & off-grid monitoring
  • Automated alerts for peak usage
  • Multi-home support
  • Advanced anomaly detection
  • Dark mode UI

๐Ÿ“ License

MIT License - Feel free to use, modify, and distribute


๐Ÿค Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ง Contact & Support


๐ŸŽฏ Status

๐Ÿš€ Active Development - v1.0.0 Released

  • โœ… Core dashboard functionality
  • โœ… Room-wise monitoring
  • โœ… Predictive analytics
  • โœ… PDF report generation
  • โณ Mobile app in progress
  • โณ Advanced ML features

โšก Monitor. Predict. Optimize. Save.

About

Real-time home energy monitoring dashboard with predictive analytics, room-wise power tracking, and integrated CEB/LECO bill payments. Built with React, FastAPI, and IoT sensors.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors