Tesla Efficiency By Weather
tesla_efficiency_by_weatherAnalyze Tesla driving efficiency grouped by actual historical weather conditions like clear, rain, snow, fog, and wind. Reveals how weather, not just temperature, affects energy consumption.
Instructions
Efficiency grouped by weather condition (via QWeather historical data).
Unlike tesla_efficiency_by_temp (which only buckets by outside_temp), this back-fills each drive's actual weather (clear/rain/snow/fog/wind) from QWeather's historical API and shows how conditions — not just temperature — affect consumption. Same 5°C day can differ hugely: dry-clear vs rain/snow.
Method (no database writes):
Pull recent drives with start/end coords, time, and ideal-range delta.
For each drive use its midpoint coordinate + mid-time to resolve a QWeather LocationID (cached) then daily historical weather (cached).
Bucket the drive by weather and aggregate kWh / distance per bucket.
To stay within API limits only the most recent drives are sampled (TESLA_WEATHER_SAMPLE_MAX, default 60). Requires QWEATHER_API_KEY + QWEATHER_API_HOST; otherwise returns a friendly hint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Look-back window in days (default: 90) | |
| car_id | No | Filter by vehicle ID (default: TESLA_CAR_ID env or first car) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |