Compare commits

...

2 Commits

Author SHA1 Message Date
Paul Bottein 6a5d812936 Only use sunny during daily forecast 2025-06-16 19:09:03 +02:00
Paul Bottein 90d0a08ba4 Fix Meteo france condition mapping 2025-06-16 19:00:34 +02:00
@@ -6,6 +6,8 @@ import time
from meteofrance_api.model.forecast import Forecast as MeteoFranceForecast
from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT,
ATTR_CONDITION_SUNNY,
ATTR_FORECAST_CONDITION,
ATTR_FORECAST_HUMIDITY,
ATTR_FORECAST_NATIVE_PRECIPITATION,
@@ -49,9 +51,12 @@ from .const import (
_LOGGER = logging.getLogger(__name__)
def format_condition(condition: str):
def format_condition(condition: str, force_day: bool = False) -> str:
"""Return condition from dict CONDITION_MAP."""
return CONDITION_MAP.get(condition, condition)
mapped_condition = CONDITION_MAP.get(condition, condition)
if force_day and mapped_condition == ATTR_CONDITION_CLEAR_NIGHT:
return ATTR_CONDITION_SUNNY
return mapped_condition
async def async_setup_entry(
@@ -212,7 +217,7 @@ class MeteoFranceWeather(
forecast["dt"]
).isoformat(),
ATTR_FORECAST_CONDITION: format_condition(
forecast["weather12H"]["desc"]
forecast["weather12H"]["desc"], force_day=True
),
ATTR_FORECAST_HUMIDITY: forecast["humidity"]["max"],
ATTR_FORECAST_NATIVE_TEMP: forecast["T"]["max"],