mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Fix falsey comparisons in NWS weather (#44486)
This commit is contained in:
parent
cfb02b5392
commit
f8ab98d2e1
@ -161,7 +161,7 @@ class NWSWeather(WeatherEntity):
|
|||||||
temp_c = None
|
temp_c = None
|
||||||
if self.observation:
|
if self.observation:
|
||||||
temp_c = self.observation.get("temperature")
|
temp_c = self.observation.get("temperature")
|
||||||
if temp_c:
|
if temp_c is not None:
|
||||||
return convert_temperature(temp_c, TEMP_CELSIUS, TEMP_FAHRENHEIT)
|
return convert_temperature(temp_c, TEMP_CELSIUS, TEMP_FAHRENHEIT)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ class NWSWeather(WeatherEntity):
|
|||||||
|
|
||||||
data[ATTR_FORECAST_WIND_BEARING] = forecast_entry.get("windBearing")
|
data[ATTR_FORECAST_WIND_BEARING] = forecast_entry.get("windBearing")
|
||||||
wind_speed = forecast_entry.get("windSpeedAvg")
|
wind_speed = forecast_entry.get("windSpeedAvg")
|
||||||
if wind_speed:
|
if wind_speed is not None:
|
||||||
if self.is_metric:
|
if self.is_metric:
|
||||||
data[ATTR_FORECAST_WIND_SPEED] = round(
|
data[ATTR_FORECAST_WIND_SPEED] = round(
|
||||||
convert_distance(wind_speed, LENGTH_MILES, LENGTH_KILOMETERS)
|
convert_distance(wind_speed, LENGTH_MILES, LENGTH_KILOMETERS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user