Arabic AI Energy Arbitrage & Optimization SaaS for Egypt
# ☀️⚡ SolarSmart EG
**Arabic AI Energy Arbitrage & Optimization SaaS for Egypt**
مستشار ذكي للطاقة الشمسية في مصر — يساعدك توفر في فاتورة الكهرباء عن طريق تحسين استخدام الطاقة الشمسية والبطارية.
## Features
- ☀️ **Solar Forecast** — 48-hour PV power forecast using Open-Meteo + pvlib
- ⚡ **Battery Optimizer** — PuLP linear programming for optimal charge/discharge
- 💰 **Tariff Engine** — Egypt's 7-tier slab pricing with savings calculator
- 💬 **Arabic Chat** — Groq + Qwen LLM in Egyptian Arabic dialect
- 🤖 **Telegram Bot** — Full Arabic bot with onboarding, forecasts, and optimization
- 🌐 **REST API** — FastAPI endpoints for web dashboard integration
## Quick Start
```bash
# Install dependencies
pip install -r requirements.txt
# Configure (edit .env with your API keys)
cp .env.example .env
# Run (starts both FastAPI server + Telegram bot)
python -m backend.main
```
## Architecture
```
backend/
├── main.py # FastAPI + Telegram bot launcher
├── config.py # Environment configuration
├── services/
│ ├── tariff_engine.py # Egypt electricity tariff calculator
│ ├── weather.py # Open-Meteo API client
│ ├── solar_forecast.py# pvlib PV power simulation
│ ├── optimizer.py # PuLP battery optimizer
│ ├── chat_agent.py # Groq + Qwen Arabic chat
│ └── storage.py # Local JSON store (MongoDB later)
├── bot/
│ ├── telegram_bot.py # aiogram bot setup
│ └── handlers/
│ └── commands.py # All bot commands
├── models/
│ └── schemas.py # Pydantic data models
└── routers/
└── api.py # REST API endpoints
```
## Bot Commands
| Command | Description |
|---------|-------------|
| `/start` | تسجيل جديد + إعداد النظام |
| `/forecast` | ☀️ توقعات الطاقة الشمسية |
| `/optimize` | ⚡ خطة البطارية المثالية |
| `/bill` | 💰 حاسبة الفاتورة والتوفير |
| `/settings` | ⚙️ إعداداتك |
| `/help` | ❓ المساعدة |
## API Endpoints
- `GET /api/tariff/{kwh}` — Calculate electricity bill
- `GET /api/tariff/{kwh}/savings` …