From 6ab6ec0ebc7fa869358a4070be7b11949192dcb0 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 5 Oct 2026 17:22:05 +0200 Subject: [PATCH] Bump open-meteo to 1.0.1 (#184329) --- homeassistant/components/open_meteo/const.py | 2 +- .../components/open_meteo/coordinator.py | 7 +++- .../components/open_meteo/manifest.json | 2 +- .../components/open_meteo/weather.py | 22 ++++++------ requirements_all.txt | 2 +- .../open_meteo/fixtures/forecast.json | 35 ++++++++++--------- 6 files changed, 38 insertions(+), 32 deletions(-) diff --git a/homeassistant/components/open_meteo/const.py b/homeassistant/components/open_meteo/const.py index a3ce48b49a1c..183e5e4ca263 100644 --- a/homeassistant/components/open_meteo/const.py +++ b/homeassistant/components/open_meteo/const.py @@ -23,7 +23,7 @@ SCAN_INTERVAL = timedelta(minutes=30) # World Meteorological Organization Weather Code # mapped to Home Assistant weather conditions. # https://www.weather.gov/tg/wmo -WMO_TO_HA_CONDITION_MAP = { +WMO_TO_HA_CONDITION_MAP: dict[int | None, str] = { 0: ATTR_CONDITION_SUNNY, # Clear sky 1: ATTR_CONDITION_SUNNY, # Mainly clear 2: ATTR_CONDITION_PARTLYCLOUDY, # Partly cloudy diff --git a/homeassistant/components/open_meteo/coordinator.py b/homeassistant/components/open_meteo/coordinator.py index c862e6333ab1..f96c1072d426 100644 --- a/homeassistant/components/open_meteo/coordinator.py +++ b/homeassistant/components/open_meteo/coordinator.py @@ -51,7 +51,12 @@ class OpenMeteoDataUpdateCoordinator(DataUpdateCoordinator[Forecast]): return await self.open_meteo.forecast( latitude=zone.attributes[EntityStateAttribute.LATITUDE], longitude=zone.attributes[EntityStateAttribute.LONGITUDE], - current_weather=True, + current=[ + HourlyParameters.TEMPERATURE_2M, + HourlyParameters.WEATHER_CODE, + HourlyParameters.WIND_DIRECTION_10M, + HourlyParameters.WIND_SPEED_10M, + ], daily=[ DailyParameters.APPARENT_TEMPERATURE_MAX, DailyParameters.PRECIPITATION_SUM, diff --git a/homeassistant/components/open_meteo/manifest.json b/homeassistant/components/open_meteo/manifest.json index a2f2a724ad52..6aaf49e9b51c 100644 --- a/homeassistant/components/open_meteo/manifest.json +++ b/homeassistant/components/open_meteo/manifest.json @@ -7,5 +7,5 @@ "documentation": "https://www.home-assistant.io/integrations/open_meteo", "integration_type": "service", "iot_class": "cloud_polling", - "requirements": ["open-meteo==0.3.2"] + "requirements": ["open-meteo==1.0.1"] } diff --git a/homeassistant/components/open_meteo/weather.py b/homeassistant/components/open_meteo/weather.py index c8517fd861ec..b4858852b360 100644 --- a/homeassistant/components/open_meteo/weather.py +++ b/homeassistant/components/open_meteo/weather.py @@ -86,35 +86,33 @@ class OpenMeteoWeatherEntity( @override def condition(self) -> str | None: """Return the current condition.""" - if not self.coordinator.data.current_weather: + if not self.coordinator.data.current: return None - return WMO_TO_HA_CONDITION_MAP.get( - self.coordinator.data.current_weather.weather_code - ) + return WMO_TO_HA_CONDITION_MAP.get(self.coordinator.data.current.weather_code) @property @override def native_temperature(self) -> float | None: """Return the platform temperature.""" - if not self.coordinator.data.current_weather: + if not self.coordinator.data.current: return None - return self.coordinator.data.current_weather.temperature + return self.coordinator.data.current.temperature_2m @property @override def native_wind_speed(self) -> float | None: """Return the wind speed.""" - if not self.coordinator.data.current_weather: + if not self.coordinator.data.current: return None - return self.coordinator.data.current_weather.wind_speed + return self.coordinator.data.current.wind_speed_10m @property @override def wind_bearing(self) -> float | str | None: """Return the wind bearing.""" - if not self.coordinator.data.current_weather: + if not self.coordinator.data.current: return None - return self.coordinator.data.current_weather.wind_direction + return self.coordinator.data.current.wind_direction_10m @callback @override @@ -132,9 +130,9 @@ class OpenMeteoWeatherEntity( datetime=_datetime.isoformat(), ) - if daily.weathercode is not None: + if daily.weather_code is not None: forecast[ATTR_FORECAST_CONDITION] = WMO_TO_HA_CONDITION_MAP.get( - daily.weathercode[index] + daily.weather_code[index] ) if daily.apparent_temperature_max is not None: diff --git a/requirements_all.txt b/requirements_all.txt index 1369f4b36371..1a66a77553d7 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1823,7 +1823,7 @@ onvif_parsers==2.5.0 open-garage==0.3.1 # homeassistant.components.open_meteo -open-meteo==0.3.2 +open-meteo==1.0.1 # homeassistant.components.cloud # homeassistant.components.litellm diff --git a/tests/components/open_meteo/fixtures/forecast.json b/tests/components/open_meteo/fixtures/forecast.json index 532b216a7789..357256f6d3bc 100644 --- a/tests/components/open_meteo/fixtures/forecast.json +++ b/tests/components/open_meteo/fixtures/forecast.json @@ -51,7 +51,7 @@ 1.3, 1.1, 0.9, 0.6, 0.5, 0.5, 0.8, 1.5, 2.5, 3.4, 3.1, 2.5, 1.8, 1.8, 2.1, 2.4, 2.5, 2.5, 2.6, 2.7 ], - "weathercode": [ + "weather_code": [ 3, 3, 3, 3, 51, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 61, 61, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 61, 3, 3, 3, 61, 61, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 61, 61, 61, 61, 3, 3, 3, @@ -120,7 +120,7 @@ 55, 44, 64, 84, 86, 88, 90, 41, 42, 42, 50, 59, 67, 56, 44, 33, 22, 11, 0, 0, 0, 0, 0, 0, 0, 20, 40, 60, 73, 87, 100, 100, 100, 100, 94 ], - "cloudcover": [ + "cloud_cover": [ 100, 100, 98, 100, 100, 98, 96, 88, 88, 100, 94, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 83, 87, 100, 100, 100, 79, 34, 7, 0, 49, 100, 99, 100, 100, 95, 100, 100, 100, 100, 96, 95, 100, 100, 100, 96, @@ -133,7 +133,7 @@ 95, 94, 93, 92, 86, 81, 75, 61, 47, 33, 54, 75, 96, 97, 99, 100, 100, 100, 100, 100 ], - "relativehumidity_2m": [ + "relative_humidity_2m": [ 95, 95, 94, 93, 95, 95, 94, 94, 95, 94, 92, 88, 85, 83, 82, 84, 89, 89, 93, 93, 95, 96, 95, 96, 94, 92, 89, 86, 87, 90, 93, 96, 97, 100, 96, 88, 85, 83, 79, 82, 84, 83, 85, 85, 84, 84, 85, 86, 87, 89, 90, 91, 92, 91, @@ -201,7 +201,7 @@ 0, 0, 0, 0, -0, -0, 0, 0, 5.7, 17.3, 44.9, 84.7, 113.8, 92.4, 52, 13.2, 0, 0, 0, -0, -0, 0, 0 ], - "dewpoint_2m": [ + "dew_point_2m": [ 6.2, 6.1, 5.9, 5.6, 5.7, 5.7, 5.6, 5.3, 5.2, 5.2, 5.3, 5.1, 4.9, 4.9, 4.8, 5, 5.6, 5.2, 5.5, 5.4, 5.3, 5.2, 5.1, 4.8, 4.5, 3.9, 3.4, 2.7, 2.3, 1.7, 1.2, 0.9, 0.4, 0.1, -0, 0, 0.5, 1.1, 1.2, 1.7, 1.9, 1.4, 1.6, 1.6, 1.5, @@ -288,7 +288,7 @@ 291, 291, 289, 286, 281, 278, 274, 268, 260, 249, 231, 218, 208, 202, 200, 199, 199, 198 ], - "winddirection_10m": [ + "wind_direction_10m": [ 261, 265, 274, 268, 275, 272, 271, 269, 258, 268, 261, 255, 256, 263, 251, 256, 233, 218, 185, 188, 173, 175, 168, 168, 158, 160, 165, 162, 149, 151, 159, 158, 170, 190, 202, 197, 202, 205, 245, 214, 223, 224, 229, 231, 238, @@ -597,7 +597,7 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], - "windspeed_10m": [ + "wind_speed_10m": [ 10.4, 10.9, 10.1, 7.9, 8.8, 8.9, 9.3, 9.4, 8.1, 9.6, 8.5, 7.6, 7.9, 7.4, 7.1, 6.4, 4, 3.1, 5, 4.3, 4.6, 4.9, 5.3, 5.3, 5.8, 6, 6.3, 5.9, 5.9, 6, 5.2, 4.7, 5.1, 7, 6.9, 6.6, 6.6, 7.8, 11.5, 10.5, 8.1, 10.1, 10.9, 10.9, @@ -627,7 +627,7 @@ 0.04, 0.04, 0.04, 0.04, 0.04, 0.05, 0.06, 0.07, 0.07, 0.08, 0.1, 0.14, 0.17, 0.16, 0.14, 0.11, 0.09, 0.07, 0.06, 0.07, 0.08, 0.1, 0.09 ], - "windgusts_10m": [ + "wind_gusts_10m": [ 22.1, 23.8, 23.5, 21.5, 18.4, 19.6, 19.9, 20.3, 19.6, 20.8, 25, 19.1, 17.9, 17.6, 16.8, 15.7, 14, 8.5, 10.4, 11, 9.5, 10.2, 11.1, 11.8, 12.2, 13, 14.4, 13.3, 13.2, 12.5, 12.7, 10.6, 10.4, 15.6, 16.8, 18.8, 15.9, @@ -719,8 +719,8 @@ "temperature_2m_max": [7.6, 5.4, 4.8, 4.5, 3.4, 2.2, 3], "precipitation_hours": [7, 5, 5, 3, 3, 13, 15], "shortwave_radiation_sum": [1.44, 2.16, 1.95, 2.05, 4.18, 2.86, 3.31], - "winddirection_10m_dominant": [251, 210, 230, 143, 143, 248, 256], - "windspeed_10m_max": [10.9, 12.9, 14.8, 10.7, 7, 13, 16.1], + "wind_direction_10m_dominant": [251, 210, 230, 143, 143, 248, 256], + "wind_speed_10m_max": [10.9, 12.9, 14.8, 10.7, 7, 13, 16.1], "apparent_temperature_min": [3.4, -2.9, -1.9, -4, -3.5, -3.6, -4.6], "sunset": [ "2021-11-24T16:04", @@ -731,7 +731,7 @@ "2021-11-29T15:59", "2021-11-30T15:59" ], - "weathercode": [61, 61, 61, 61, 61, 77, 80], + "weather_code": [61, 61, 61, 61, 61, 77, 80], "sunrise": [ "2021-11-24T07:41", "2021-11-25T07:43", @@ -743,7 +743,7 @@ ], "apparent_temperature_max": [5.5, 3.2, 1.4, 0.6, 0.4, -1.2, -0.3], "temperature_2m_min": [5.5, 0.2, 1.8, -0.1, -0.2, -0.5, -0.3], - "windgusts_10m_max": [8.5, 10.4, 16, 18.1, 10.9, 3.3, 14.9], + "wind_gusts_10m_max": [8.5, 10.4, 16, 18.1, 10.9, 3.3, 14.9], "precipitation_sum": [0.19, 0.29, 0.76, 0.12, 0.15, 0.64, 1.74], "time": [ "2021-11-24", @@ -756,6 +756,8 @@ ] }, "utc_offset_seconds": 3600, + "timezone": "Europe/Berlin", + "timezone_abbreviation": "CET", "hourly_units": { "precipitation": "mm", "shortwave_radiation": "W/m²", @@ -798,11 +800,12 @@ }, "longitude": 13.419998, "elevation": 44.8125, - "current_weather": { - "temperature": 5.5, - "windspeed": 5.3, - "weathercode": 3, - "winddirection": 168, + "current": { + "interval": 900, + "temperature_2m": 5.5, + "wind_speed_10m": 5.3, + "weather_code": 3, + "wind_direction_10m": 168, "time": "2021-11-24T23:00" } }