From ecd2f8e0726583b354999a550c7c89e14f9672fd Mon Sep 17 00:00:00 2001 From: tronikos Date: Sun, 6 Sep 2026 23:30:15 -0700 Subject: [PATCH] Fix small issues in Google Weather (#181483) --- .../components/google_weather/__init__.py | 30 ++++++++++++------- .../components/google_weather/icons.json | 3 -- .../components/google_weather/sensor.py | 1 - 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/google_weather/__init__.py b/homeassistant/components/google_weather/__init__.py index 54d5c6c2bd22..0b8bff8f25ec 100644 --- a/homeassistant/components/google_weather/__init__.py +++ b/homeassistant/components/google_weather/__init__.py @@ -31,6 +31,8 @@ async def async_setup_entry( api_key=entry.data[CONF_API_KEY], referrer=entry.data.get(CONF_REFERRER), language_code=hass.config.language, + # The entities report native values in metric units. + units_system="METRIC", ) subentries_runtime_data: dict[str, GoogleWeatherSubEntryRuntimeData] = {} for subentry in entry.subentries.values(): @@ -46,16 +48,24 @@ async def async_setup_entry( ), ) subentries_runtime_data[subentry.subentry_id] = subentry_runtime_data - tasks = [ - coro - for subentry_runtime_data in subentries_runtime_data.values() - for coro in ( - subentry_runtime_data.coordinator_observation.async_config_entry_first_refresh(), - subentry_runtime_data.coordinator_daily_forecast.async_config_entry_first_refresh(), - subentry_runtime_data.coordinator_hourly_forecast.async_config_entry_first_refresh(), - ) - ] - await asyncio.gather(*tasks) + # Wait for every refresh to settle before failing, so that no refresh outlives + # a setup that did not complete. Exceptions are re-raised as-is, so that + # ConfigEntryNotReady and ConfigEntryAuthFailed keep their meaning. + results = await asyncio.gather( + *( + coordinator.async_config_entry_first_refresh() + for subentry_runtime_data in subentries_runtime_data.values() + for coordinator in ( + subentry_runtime_data.coordinator_observation, + subentry_runtime_data.coordinator_daily_forecast, + subentry_runtime_data.coordinator_hourly_forecast, + ) + ), + return_exceptions=True, + ) + for result in results: + if isinstance(result, BaseException): + raise result entry.runtime_data = GoogleWeatherRuntimeData( api=api, subentries_runtime_data=subentries_runtime_data, diff --git a/homeassistant/components/google_weather/icons.json b/homeassistant/components/google_weather/icons.json index b8927a1578f4..07b4e989ff7f 100644 --- a/homeassistant/components/google_weather/icons.json +++ b/homeassistant/components/google_weather/icons.json @@ -7,9 +7,6 @@ "precipitation_probability": { "default": "mdi:weather-rainy" }, - "precipitation_qpf": { - "default": "mdi:cup-water" - }, "thunderstorm_probability": { "default": "mdi:weather-lightning" }, diff --git a/homeassistant/components/google_weather/sensor.py b/homeassistant/components/google_weather/sensor.py index 5e19f1d8d8fc..399206594322 100644 --- a/homeassistant/components/google_weather/sensor.py +++ b/homeassistant/components/google_weather/sensor.py @@ -198,7 +198,6 @@ async def async_setup_entry( ( GoogleWeatherSensor(coordinator, subentry, description) for description in SENSOR_TYPES - if description.value_fn(coordinator.data) is not None ), config_subentry_id=subentry.subentry_id, )