mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +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
|
@property
|
||||||
def temperature(self):
|
def temperature(self):
|
||||||
"""Return the temperature."""
|
"""Return the temperature."""
|
||||||
if self.ec_data.conditions.get("temperature", {}).get("value"):
|
if (
|
||||||
return float(self.ec_data.conditions["temperature"]["value"])
|
temperature := self.ec_data.conditions.get("temperature", {}).get("value")
|
||||||
if self.ec_data.hourly_forecasts and self.ec_data.hourly_forecasts[0].get(
|
) is not None:
|
||||||
"temperature"
|
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
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user