From 8f5f675d65f05a8cd4568331a07f1b0da13bf8a6 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 28 May 2022 01:42:51 -0700 Subject: [PATCH] NuWeather: add current_data_city fallback --- NuWeather/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NuWeather/plugin.py b/NuWeather/plugin.py index f024a37..e605ea6 100644 --- a/NuWeather/plugin.py +++ b/NuWeather/plugin.py @@ -320,11 +320,11 @@ class NuWeather(callbacks.Plugin): current_data = self._wwis_load_current() display_name = f"{city_data['cityName']}, {city_data['member']['shortMemName'] or city_data['member']['memName']}" + current_data_city = None for current_data_city in current_data['present'].values(): if current_data_city['cityId'] == cityid: break - else: - log.error(current_data_city) + if not current_data_city: raise ValueError(f"Could not find current conditions for cityID {cityid} ({display_name})") return { 'location': display_name,