Inspiration
As energy demands grow and sustainability becomes more important, I wanted to create a tool that empowers users to understand and optimize their electricity usage. I was inspired by how AI can translate raw data into meaningful actions — and how combining it with real-time energy data could lead to real savings and smarter living.
What it does
The Smart Energy Management Dashboard helps users understand and optimize their household electricity usage using data-driven insights. It connects to a MongoDB database storing historical energy consumption and performs the following:
- Energy Summary: Displays average and peak usage by hour, along with percentage differences.
- Load Balancing: Flags high-load hours and highlights when usage exceeds safe thresholds.
- Smart Scheduling: Recommends the best hours to run appliances like AC, washing machines, or EV chargers, based on power load patterns.
How we built it
Backend
MongoDB Atlas stores detailed household energy consumption data with fields like:
Datetime,Global_active_power,Sub_metering_1/2/3,Voltage, etc.Flask Routes:
/summary: Shows peak usage hours and daily patterns./balancing: Visualizes high-load hours and flags optimization opportunities./scheduling: Recommends optimal times to run specific appliances./generate: (Optional) Uses OpenAI's API to generate personalized energy-saving tips.
Frontend
- HTML pages rendered using Jinja templates (
summary.html,balancing.html,scheduling.html). - Clean UI built with Tailwind CSS, emphasizing readability and responsiveness.
- Hyperlinks on the home page for navigation between modules.
Tools & Libraries
- Flask, pymongo, pandas, openai, dotenv
- Hosted locally, connected to MongoDB Atlas for remote data.
Challenges we ran into
- MongoDB Atlas SSL Errors: Faced certificate verification issues due to local Python version; resolved by installing certificates and using correct connection string.
- Data Cleanup: MongoDB documents had varied time formats, requiring careful parsing in Pandas.
- Blank Page Debugging: Early HTML templates didn't render because
hourly.to_dict()returned empty — traced it back to an empty DataFrame due toDatetimeparsing failure. - AI Rate Limits: During Gemini integration, had to manage rate limits and ensure prompts were clean and concise.
Accomplishments that we're proud of
- Successfully connected MongoDB Atlas to a Flask web application and queried real-time energy data.
- Built a dynamic, responsive dashboard with Tailwind CSS and Jinja templating.
- Applied Pandas to transform and analyze time-series electricity data.
- Implemented smart logic for scheduling based on load thresholds.
- Integrated OpenAI's GPT model to generate personalized, human-readable energy-saving advice.
- Solved real-world issues like SSL certificate errors and blank template rendering.
What we learned
- How to use Flask to build dynamic web applications.
- How to integrate MongoDB Atlas to store and fetch time-series energy data.
- How to process data using Pandas for summarization, scheduling, and analysis.
- How to use OpenAI GPT models to add intelligent insights and personalized suggestions.
- How to design a clean UI using HTML + Tailwind CSS.
What's next for Smart Energy Management
- User Login & Personalization: Let users upload or view their own consumption data and receive tailored suggestions.
- Data Visualization: Add interactive charts (e.g., via Plotly or Chart.js) to make data exploration more intuitive.
- Energy Forecasting: Use machine learning to predict next-day or week’s load patterns and alert users about peak risks.
- Email Reports: Automatically send daily or weekly summaries and AI-generated tips to users.
- Appliance-Level Control: Expand scheduling logic to control smart plugs/devices in real time based on load analysis.
Log in or sign up for Devpost to join the conversation.