How roshithabasuru/energywatch works
EnergyWatch is a Flask smart-grid portal for consumers and utility operators. Consumers authenticate, review consumption, manage schedules and alerts, participate in demand-response events, and access billing; operators manage zones and pricing, monitor grid usage, and create events. The app factory registers these route modules, which use SQLAlchemy-backed domain models; audit records use MongoDB. The README describes the product capabilities, while billing, consumption, and several other route implementations were not excerpted, so their internal steps are not expanded here.
Main entry points: __init__.py Flask app · demand_response/routes.py Demand response · scheduler.py Scheduled processing · schedules/routes.py Schedules and alerts
Components 23
Web entry and access
- Flask app
app/__init__.py - Authentication
app/blueprints/auth/routes.py - Role access
app/utils/decorators.py
Grid and consumption
- Consumption views
app/blueprints/consumption/routes.py - Meter data
app/models/consumption.py - Grid zones
app/models/grid.py
Consumer services
- Consumer profile
app/blueprints/consumer/routes.py - Schedules and alerts
app/blueprints/schedules/routes.py - Load schedules
app/models/scheduler.py - Alerts and notices
app/models/alert.py - Billing
app/blueprints/billing/routes.py - Billing records
app/models/billing.py - Notifications
app/blueprints/notifications/routes.py
Utility operations
- Grid operations
app/blueprints/operator/routes.py - Pricing tiers
app/models/pricing.py - Demand response
app/blueprints/demand_response/routes.py - DR events
app/models/demand_response.py - Scheduled processing
scheduler.py
Persistence and audit
- Users and profiles
app/models/user.py - Audit log
app/models/audit.py - SQLAlchemy services
app/extensions.py
Other components
- Consumer
- Operator
Connections 42
- Consumer → Flask app: uses portal
- Operator → Flask app: uses portal
- Flask app → Authentication: registers
app/__init__.py - Flask app → Consumer profile: registers
app/__init__.py - Flask app → Grid operations: registers
app/__init__.py - Flask app → Consumption views: registers
app/__init__.py - Flask app → Demand response: registers
app/__init__.py - Flask app → Schedules and alerts: registers
app/__init__.py - Flask app → Notifications: registers
app/__init__.py - Flask app → Billing: registers
app/__init__.py - Authentication → Users and profiles: authenticates
app/blueprints/auth/routes.py - Grid operations → Role access: checks role
app/blueprints/operator/routes.py - Demand response → Role access: checks role
app/blueprints/demand_response/routes.py - Schedules and alerts → Role access: checks role
app/blueprints/schedules/routes.py - Consumer profile → Grid zones: reads and updates
app/blueprints/consumer/routes.py - Consumption views → Meter data: reads and writes
app/blueprints/consumption/routes.py - Grid operations → Grid zones: manages
app/blueprints/operator/routes.py - Grid operations → Pricing tiers: manages
app/blueprints/operator/routes.py - Grid operations → Meter data: aggregates
app/blueprints/operator/routes.py - Demand response → Grid zones: selects zone
app/blueprints/demand_response/routes.py - Demand response → DR events: creates and enrolls
app/blueprints/demand_response/routes.py - Demand response → Meter data: calculates baseline
app/blueprints/demand_response/routes.py - Demand response → Alerts and notices: queues notices
app/blueprints/demand_response/routes.py - Demand response → Users and profiles: reads profiles
app/blueprints/demand_response/routes.py - Schedules and alerts → Load schedules: manages schedules
app/blueprints/schedules/routes.py - Schedules and alerts → Alerts and notices: manages rules
app/blueprints/schedules/routes.py - Schedules and alerts → Pricing tiers: checks rates
app/blueprints/schedules/routes.py - Billing → Meter data: uses consumption
app/blueprints/billing/routes.py - Billing → Pricing tiers: uses rates
app/blueprints/billing/routes.py - Billing → Billing records: manages billing
app/blueprints/billing/routes.py - Notifications → Alerts and notices: reads notices
app/blueprints/notifications/routes.py - Scheduled processing → DR events: processes events
scheduler.py - Scheduled processing → Alerts and notices: updates notices
scheduler.py - Scheduled processing → Meter data: reads consumption
scheduler.py - Scheduled processing → Pricing tiers: reads rates
scheduler.py - Scheduled processing → Billing records: updates billing
scheduler.py - Scheduled processing → Users and profiles: reads users
scheduler.py - SQLAlchemy services → Meter data: provides ORM
app/models/consumption.py - SQLAlchemy services → Users and profiles: provides ORM
app/models/user.py - Grid operations → Audit log: records actions
app/blueprints/operator/routes.py - Demand response → Audit log: records actions
app/blueprints/demand_response/routes.py - Schedules and alerts → Audit log: records actions
app/blueprints/schedules/routes.py