Fix wind speed change in NWS (#37222)
parent
b0942d86fe
commit
11debb1568
|
@ -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
|
||||
|
|
|
@ -60,7 +60,7 @@ EXPECTED_OBSERVATION_IMPERIAL = {
|
|||
),
|
||||
ATTR_WEATHER_WIND_BEARING: 180,
|
||||
ATTR_WEATHER_WIND_SPEED: round(
|
||||
convert_distance(10, LENGTH_METERS, LENGTH_MILES) * 3600
|
||||
convert_distance(10, LENGTH_KILOMETERS, LENGTH_MILES)
|
||||
),
|
||||
ATTR_WEATHER_PRESSURE: round(
|
||||
convert_pressure(100000, PRESSURE_PA, PRESSURE_INHG), 2
|
||||
|
@ -74,9 +74,7 @@ EXPECTED_OBSERVATION_IMPERIAL = {
|
|||
EXPECTED_OBSERVATION_METRIC = {
|
||||
ATTR_WEATHER_TEMPERATURE: 10,
|
||||
ATTR_WEATHER_WIND_BEARING: 180,
|
||||
ATTR_WEATHER_WIND_SPEED: round(
|
||||
convert_distance(10, LENGTH_METERS, LENGTH_KILOMETERS) * 3600
|
||||
),
|
||||
ATTR_WEATHER_WIND_SPEED: 10,
|
||||
ATTR_WEATHER_PRESSURE: round(convert_pressure(100000, PRESSURE_PA, PRESSURE_HPA)),
|
||||
ATTR_WEATHER_VISIBILITY: round(
|
||||
convert_distance(10000, LENGTH_METERS, LENGTH_KILOMETERS)
|
||||
|
|
Loading…
Reference in New Issue