mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-26 13:01:07 -05:00
NuWeather: add current_data_city fallback
This commit is contained in:
parent
eb376d8554
commit
8f5f675d65
@ -320,11 +320,11 @@ class NuWeather(callbacks.Plugin):
|
|||||||
current_data = self._wwis_load_current()
|
current_data = self._wwis_load_current()
|
||||||
display_name = f"{city_data['cityName']}, {city_data['member']['shortMemName'] or city_data['member']['memName']}"
|
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():
|
for current_data_city in current_data['present'].values():
|
||||||
if current_data_city['cityId'] == cityid:
|
if current_data_city['cityId'] == cityid:
|
||||||
break
|
break
|
||||||
else:
|
if not current_data_city:
|
||||||
log.error(current_data_city)
|
|
||||||
raise ValueError(f"Could not find current conditions for cityID {cityid} ({display_name})")
|
raise ValueError(f"Could not find current conditions for cityID {cityid} ({display_name})")
|
||||||
return {
|
return {
|
||||||
'location': display_name,
|
'location': display_name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user