mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-24 02:16:14 +00:00
fix: #611 if current not exist use main section to get temperature
This commit is contained in:
committed by
Florian BEZANNIER
parent
004b9ef485
commit
8d35953747
@@ -16,7 +16,8 @@ def get_temp(latitude: str, longitude: str, api_key: str) -> float:
|
||||
"appid": api_key,
|
||||
"units": "metric"},
|
||||
timeout=TIMEOUT_IN_S)
|
||||
temp = weather_rep.json()["current"]["temp"]
|
||||
weather_res_json = weather_rep.json()
|
||||
temp = weather_res_json.get("current", weather_res_json.get("main"))["temp"]
|
||||
logger.debug("Temperature :%fc", temp)
|
||||
return temp
|
||||
except ConnectionError:
|
||||
|
||||
Reference in New Issue
Block a user