mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Environment Canada: Fix for when temperature is zero (#69101)
This commit is contained in:
parent
538c8160f3
commit
912923f55d
@ -80,12 +80,16 @@ class ECWeather(CoordinatorEntity, WeatherEntity):
|
||||
@property
|
||||
def temperature(self):
|
||||
"""Return the temperature."""
|
||||
if self.ec_data.conditions.get("temperature", {}).get("value"):
|
||||
return float(self.ec_data.conditions["temperature"]["value"])
|
||||
if self.ec_data.hourly_forecasts and self.ec_data.hourly_forecasts[0].get(
|
||||
"temperature"
|
||||
if (
|
||||
temperature := self.ec_data.conditions.get("temperature", {}).get("value")
|
||||
) is not None:
|
||||
return float(temperature)
|
||||
if (
|
||||
self.ec_data.hourly_forecasts
|
||||
and (temperature := self.ec_data.hourly_forecasts[0].get("temperature"))
|
||||
is not None
|
||||
):
|
||||
return float(self.ec_data.hourly_forecasts[0]["temperature"])
|
||||
return float(temperature)
|
||||
return None
|
||||
|
||||
@property
|
||||
|
Loading…
x
Reference in New Issue
Block a user