Smart home climate advisor for Kingston, Ontario โ Real-time IoT sensors + AI-powered recommendations to optimize comfort, save money, and reduce carbon emissions.
Built for QHacks 2026.
- Real-time monitoring with ESP32 + DHT11 sensor (temperature, humidity, pressure)
- AI recommendations powered by Google Gemini 2.0 โ when to open windows, adjust thermostat, or use heating/cooling
- Mold risk detection with historical humidity analysis
- Indoor humidity estimation when sensor is offline
- Live Ontario electricity pricing (TOU/ULO/Tiered plans) with accurate time-of-use rates
- Next rate preview โ see when prices change and plan accordingly
- Cost calculator โ estimate heating/cooling costs in real-time
- Savings tracker โ daily summaries of money saved vs. baseline behavior
- Carbon footprint tracking โ kg COโ avoided through smart ventilation
- Community projections โ model citywide impact if Kingston households adopt Goldilocks
- Equivalences โ trees planted, km not driven, household energy comparisons
- Conversational chat with live sensor data and weather context
- Voice input/output (browser-native Web Speech API โ no dependencies)
- Auto-generated suggestions โ proactive tips based on conditions, electricity rates, and weather forecasts
- Colorblind mode โ alternative color palettes (blue/teal/orange) for all visualizations
- Toggle in settings โ persists via localStorage
- 24-hour humidity timeline with trend analysis
- Forecast preview (3-hour intervals, precipitation probability)
- Savings charts โ daily/monthly breakdowns
- Carbon milestones โ cumulative impact with equivalences
| Layer | Technologies |
|---|---|
| Frontend | Next.js 14, React 18, Tailwind CSS, SWR, Recharts, Web Speech API |
| Backend | Node.js, Express.js, better-sqlite3, Google Gemini AI SDK |
| Hardware | ESP32 Dev Module, DHT11 Sensor (Keystudio) |
| APIs | Google Gemini 2.0 (Flash/Flash-Lite), OpenWeatherMap |
| Database | SQLite (local) |
| Deployment | Vercel (frontend), Railway (backend, planned) |
- Node.js 18+ and npm
- Arduino IDE (for ESP32 firmware)
- ESP32 board + DHT11 sensor (optional โ demo mode works without hardware)
git clone https://github.com/yourusername/goldilocks-kingston.git
cd goldilocks-kingston# Backend
cd backend
npm install
# Frontend
cd ../frontend
npm installCreate a .env file in the project root:
# Required
GEMINI_API=your_gemini_api_key_here
# Optional
OPENWEATHERMAP_API_KEY=your_openweathermap_key # For live weather (falls back to mock data)
DEMO_MODE=false # Set to 'true' for simulated sensor data
BACKEND_PORT=3001Get API keys:
- Google AI Studio (Gemini)
- OpenWeatherMap (Weather)
cd backend
npm run devBackend will start on http://localhost:3001
cd frontend
npm run devFrontend will start on http://localhost:3000
- Open
esp32_sensor/esp32_sensor.inoin Arduino IDE - Install DHT sensor library (Adafruit DHT) via Library Manager
- Update WiFi credentials and backend URL in the sketch:
const char* ssid = "Your_WiFi_SSID"; const char* password = "Your_WiFi_Password"; const char* serverUrl = "http://YOUR_BACKEND_IP:3001/api/readings";
- Select Board: ESP32 Dev Module and flash
Wiring:
- DHT11 Data โ GPIO2
- DHT11 VCC โ 3.3V
- DHT11 GND โ GND
goldilocks-kingston/
โโโ backend/
โ โโโ db/ # SQLite database + init scripts
โ โโโ logic/ # Business logic (AI, rates, weather, carbon, etc.)
โ โโโ server.js # Express API server
โ โโโ seedHistorical.js # Data seeding script
โโโ frontend/
โ โโโ components/ # React components
โ โโโ lib/ # API client, utilities, Context providers
โ โโโ pages/ # Next.js pages (dashboard, carbon, savings, settings, chat)
โ โโโ styles/ # Global CSS + colorblind mode variables
โโโ esp32_sensor/
โ โโโ esp32_sensor.ino # Arduino firmware for ESP32 + DHT11
โโโ gateway/
โ โโโ index.js # (Legacy) Gateway for serial ESP32 data forwarding
โโโ PRD.md # Product requirements document
โโโ README.md
No ESP32 hardware? No problem. Enable demo mode to simulate realistic sensor data:
- Set
DEMO_MODE=truein.env - Restart backend
- Simulated readings will be generated automatically (temperature cycles, humidity patterns)
- Go to Settings โ Accessibility
- Toggle "Colorblind Mode"
- All green/yellow/red indicators switch to blue/teal/orange
Affects: badges, charts, recommendation cards, carbon widgets, sensor status indicators.
Rates sourced from Utilities Kingston (OEB Nov 1, 2025):
| Plan | Description | Key Rates |
|---|---|---|
| TOU | Time-of-Use | Off-Peak: 9.8ยข, Mid-Peak: 15.7ยข, On-Peak: 20.3ยข |
| ULO | Ultra-Low Overnight | Overnight: 3.9ยข, Mid-Peak: 15.7ยข, On-Peak: 39.1ยข |
| Tiered | Fixed tiers by usage | Tier 1: 10.3ยข, Tier 2: 12.5ยข |
Winter peak hours (current):
- Weekdays: On-Peak 7โ11am & 5โ7pm, Mid-Peak 11amโ5pm
- Weekends: All Off-Peak
Rates update dynamically based on EST timezone, season (winter/summer), and time of day.
To populate the database with 24 hours of backfilled readings (for testing/demos):
cd backend
node seedHistorical.jsThis creates ~2,880 readings for the ESP32 sensor with realistic temperature/humidity patterns.
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/health |
Health check |
POST |
/api/readings |
Receive sensor data (from ESP32) |
GET |
/api/dashboard |
Dashboard data (indoor, outdoor, recommendations, savings, etc.) |
GET |
/api/carbon |
Carbon impact data |
GET |
/api/savings?period=today |
Savings breakdown |
GET |
/api/notifications |
Smart suggestions & alerts |
POST |
/api/chat |
Gemini AI chat |
GET |
/api/settings |
User settings |
PUT |
/api/settings |
Update settings |
GET |
/api/humidity/timeline |
24h humidity data |
This is a QHacks 2026 hackathon project. Feel free to fork, experiment, and submit PRs!
MIT License โ see LICENSE file for details.
- Ontario Energy Board โ Electricity rate data
- OpenWeatherMap โ Weather API
- Google Gemini AI โ Conversational intelligence
- City of Kingston โ Community Energy Plan data
- QHacks 2026 โ Inspiration and deadline motivation ๐
Built by [Your Name/Team]
QHacks 2026 | Kingston, Ontario
GitHub: yourusername/goldilocks-kingston