Skip to content

darkeneddd/solstice

Repository files navigation

Solstice - AI-Powered Solar Planning

An AI-powered solar energy planning tool that helps users analyze solar potential for any location, estimate energy production, and calculate ROI.

Features

  • Location Analyzer: Search any address or click on a map to get detailed solar production estimates
  • Interactive Charts: View monthly energy production, solar radiation, and payback analysis
  • AI Chatbot: Ask questions about solar energy and get data-driven answers
  • Heat Map: Visualize solar potential across regions

Project Structure

solstice/
├── backend/              # Python FastAPI server
│   ├── api.py           # Main API endpoints
│   ├── solar_lookup.py  # NREL PVWatts integration
│   ├── chatbot/         # Gemini AI chatbot
│   └── requirements.txt # Python dependencies
├── solar1-ai/           # React frontend
│   ├── src/
│   │   ├── pages/       # Page components
│   │   └── components/  # Shared components
│   └── package.json     # Node dependencies
└── README.md

Prerequisites

Setup Guide

1. Clone the Repository

git clone https://github.com/darkeneddd/solstice.git
cd solstice

2. Backend Setup

Install Python Dependencies

cd backend
pip3 install -r requirements.txt

Or install manually:

pip3 install fastapi uvicorn python-dotenv requests pydantic google-generativeai

Configure API Keys

Create a .env file in the backend/ folder:

# backend/.env
NREL_API_KEY=your_nrel_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here

Run the Backend Server

cd backend
python3 -m uvicorn api:app --reload --port 8002

The API will be available at http://localhost:8002

3. Frontend Setup

Install Node Dependencies

cd solar1-ai
npm install

Run the Frontend

npm start

The app will open at http://localhost:3000

API Endpoints

Endpoint Method Description
/api/solar GET Get solar data for a location (by name or coordinates)
/api/geocode GET Convert address to coordinates
/api/chat POST Chat with the AI assistant
/api/solar/batch GET Get solar data for multiple locations

Example API Calls

Get solar data by location name:

curl "http://localhost:8002/api/solar?location=Atlanta,GA&system_kw=4"

Get solar data by coordinates:

curl "http://localhost:8002/api/solar?lat=33.749&lon=-84.388&system_kw=4"

Chat with AI assistant:

curl -X POST "http://localhost:8002/api/chat" \
  -H "Content-Type: application/json" \
  -d '{"message": "Which city is better for solar?", "locations": ["Atlanta, GA", "Seattle, WA"]}'

Troubleshooting

"command not found: uvicorn"

Use Python module syntax instead:

python3 -m uvicorn api:app --reload --port 8002

"Address already in use"

Another process is using the port. Try a different port:

python3 -m uvicorn api:app --reload --port 8003

"PVWatts Error: 403 Forbidden"

Your NREL API key is missing or invalid. Check your .env file.

"Chat error" or 500 errors on /api/chat

Make sure:

  1. google-generativeai is installed: pip3 install google-generativeai
  2. Your GEMINI_API_KEY is set in .env
  3. Restart the backend after changing .env

Tech Stack

  • Frontend: React, Leaflet (maps), Recharts (charts)
  • Backend: FastAPI, Python
  • APIs: NREL PVWatts (solar data), Google Gemini (AI)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors