Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26ecc3e5fd |
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.10.11] - 2026-01-08
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Weather wind direction** - Convert integer degrees to cardinal direction string
|
||||
- Scheduler stores wind_direction as degrees (e.g., 135)
|
||||
- Schema expects string (e.g., "SE")
|
||||
- Added `_degrees_to_cardinal()` conversion
|
||||
|
||||
## [1.10.10] - 2026-01-08
|
||||
|
||||
### Fixed
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "core-api"
|
||||
version = "1.10.10"
|
||||
version = "1.10.11"
|
||||
description = "Core Code API - Infrastructure management and tools API"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
|
||||
@@ -43,13 +43,18 @@ class EnvironmentService:
|
||||
return None
|
||||
|
||||
try:
|
||||
# Handle wind direction - convert degrees to cardinal if integer
|
||||
wind_dir = raw_data.get("wind_direction") or raw_data.get("wind_dir")
|
||||
if isinstance(wind_dir, (int, float)):
|
||||
wind_dir = self._degrees_to_cardinal(wind_dir)
|
||||
|
||||
return WeatherData(
|
||||
temperature=raw_data.get("temperature") or raw_data.get("temp"),
|
||||
feels_like=raw_data.get("feels_like") or raw_data.get("feelslike"),
|
||||
conditions=raw_data.get("conditions") or raw_data.get("weather") or raw_data.get("description"),
|
||||
humidity=raw_data.get("humidity"),
|
||||
wind_speed=raw_data.get("wind_speed") or raw_data.get("windspeed") or raw_data.get("wind"),
|
||||
wind_direction=raw_data.get("wind_direction") or raw_data.get("wind_dir"),
|
||||
wind_direction=wind_dir,
|
||||
pressure=raw_data.get("pressure"),
|
||||
visibility=raw_data.get("visibility"),
|
||||
uv_index=raw_data.get("uv_index") or raw_data.get("uv"),
|
||||
@@ -60,6 +65,13 @@ class EnvironmentService:
|
||||
logger.warning(f"Failed to parse weather data: {e}")
|
||||
return None
|
||||
|
||||
def _degrees_to_cardinal(self, degrees: float) -> str:
|
||||
"""Convert wind direction degrees to cardinal direction."""
|
||||
directions = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE",
|
||||
"S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"]
|
||||
index = round(degrees / 22.5) % 16
|
||||
return directions[index]
|
||||
|
||||
def _parse_forecast(self, raw_data: Any) -> Optional[List[ForecastDay]]:
|
||||
"""
|
||||
Parse raw forecast data into list of ForecastDay schemas.
|
||||
|
||||
Reference in New Issue
Block a user