|
Download backend/HF_README.md from SolarWine/api: direct link, hf CLI and curl.
- Browser
- Download file 3.04 kB
-
https://huggingface.co/spaces/SolarWine/api/resolve/main/backend/HF_README.md
- Command line
-
hf download hf://spaces/SolarWine/api/backend/HF_README.md
-
curl -L -o HF_README.md https://huggingface.co/spaces/SolarWine/api/resolve/main/backend/HF_README.md
3.04 kB
| title: SolarWine API | |
| emoji: πΏ | |
| colorFrom: green | |
| colorTo: yellow | |
| sdk: docker | |
| app_port: 7860 | |
| private: true | |
| # SolarWine API | |
| FastAPI backend for the SolarWine agrivoltaic vineyard control system. | |
| ## Endpoints | |
| ### Health & Monitoring | |
| - `GET|HEAD /api/health` β system health (uptime, Redis, TB, IMS, Gemini status) | |
| - `GET /api/health/data` β data freshness per source (age, ok/degraded) | |
| - `GET /api/health/data-sources` β per-source green/yellow/red status with thresholds | |
| ### Weather (IMS Station 43) | |
| - `GET /api/weather/current` β latest weather readings + data age | |
| - `GET /api/weather/history?start_date&end_date&format` β historical weather (hourly) | |
| - `GET /api/weather/forecast` β weather forecast | |
| ### Vine Sensors (ThingsBoard) | |
| - `GET /api/sensors/snapshot` β latest readings (treatment vs reference) | |
| - `GET /api/sensors/history?type&area&hours` β sensor time-series | |
| - `GET /api/sensors/soil-moisture?hours` β soil moisture history | |
| - `GET /api/sensors/rain?hours` β rainfall history | |
| ### Energy | |
| - `GET /api/energy/current` β current power output (kW) | |
| - `GET /api/energy/daily/{date}` β daily production + hourly profile | |
| - `GET /api/energy/history` β energy generation time-series | |
| - `GET /api/energy/predict/{date}` β predicted daily generation | |
| ### Photosynthesis | |
| - `GET /api/photosynthesis/current?model` β current A rate (FvCB or ML) | |
| - `GET /api/photosynthesis/forecast` β 24h predicted A profile | |
| ### Control System | |
| - `GET /api/control/status` β last control loop tick | |
| - `GET /api/control/plan` β current day-ahead plan | |
| - `GET /api/control/budget` β energy budget status | |
| - `GET /api/control/trackers` β tracker angles and modes | |
| ### Chatbot (Gemini AI) | |
| - `POST /api/chatbot/message` β send message to vineyard advisor | |
| - `POST /api/chatbot/feedback` β submit feedback on response | |
| - `GET /api/chatbot/briefing` β current system status briefing | |
| ### Biology | |
| - `GET /api/biology/phenology` β current growth stage | |
| - `GET /api/biology/rules` β all biology rules | |
| - `GET /api/biology/rules/{name}` β single rule detail | |
| - `GET /api/biology/chill-units?season_start` β accumulated chill units | |
| ### Auth | |
| - `POST /api/auth/login` β JWT token (guest mode when JWT_SECRET unset) | |
| ### Events | |
| - `GET /api/events/stream` β SSE stream for live frontend updates | |
| Interactive docs at `/docs`. | |
| ## Environment Variables | |
| | Variable | Required | Description | | |
| |----------|----------|-------------| | |
| | `IMS_API_TOKEN` | Yes | IMS weather API token | | |
| | `THINGSBOARD_HOST` | Yes | ThingsBoard server URL | | |
| | `THINGSBOARD_USERNAME` | Yes | ThingsBoard login | | |
| | `THINGSBOARD_PASSWORD` | Yes | ThingsBoard password | | |
| | `GOOGLE_API_KEY` | No | Gemini AI for chatbot/advisor | | |
| | `JWT_SECRET` | No | JWT signing key (guest mode if unset) | | |
| | `ADMIN_PASSWORD` | No | Login password | | |
| | `REDIS_URL` | No | Upstash Redis for shared cache | | |
| | `SENTRY_DSN` | No | Sentry error tracking | | |
| | `SMTP_HOST` | No | Email alerts (with ALERT_EMAIL_TO) | | |
| | `ALERT_EMAIL_TO` | No | Alert recipient email(s) | | |