Fix wind speed change in NWS (#37222)

This commit is contained in:
MatthewFlamm authored and Paulus Schoutsen committed 2020-06-30 00:25:33 +00:00
1 parent 4d7a468c0e
commit edc44230b4
2 files changed
+7 -10

No files matched your search

+5 -6
View File
@@ -190,17 +190,16 @@ class NWSWeather(WeatherEntity):
@property
def wind_speed(self):
"""Return the current windspeed."""
wind_m_s = None
wind_km_hr = None
if self.observation:
wind_m_s = self.observation.get("windSpeed")
if wind_m_s is None:
wind_km_hr = self.observation.get("windSpeed")
if wind_km_hr is None:
return None
wind_m_hr = wind_m_s * 3600
if self.is_metric:
wind = convert_distance(wind_m_hr, LENGTH_METERS, LENGTH_KILOMETERS)
wind = wind_km_hr
else:
wind = convert_distance(wind_m_hr, LENGTH_METERS, LENGTH_MILES)
wind = convert_distance(wind_km_hr, LENGTH_KILOMETERS, LENGTH_MILES)
return round(wind)
@property