From 052c673c9e3d4bc46a04bfc6f0ac94e171771aa4 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Wed, 26 Oct 2022 13:47:29 +0200 Subject: [PATCH] Use `wind_speed` device class instead of `speed` in Accuweather (#81016) --- homeassistant/components/accuweather/sensor.py | 12 ++++++------ tests/components/accuweather/test_sensor.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/accuweather/sensor.py b/homeassistant/components/accuweather/sensor.py index 0238026c1a0..78041c5309c 100644 --- a/homeassistant/components/accuweather/sensor.py +++ b/homeassistant/components/accuweather/sensor.py @@ -190,7 +190,7 @@ FORECAST_SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = ( ), AccuWeatherSensorDescription( key="WindGustDay", - device_class=SensorDeviceClass.SPEED, + device_class=SensorDeviceClass.WIND_SPEED, icon="mdi:weather-windy", name="Wind gust day", entity_registry_enabled_default=False, @@ -202,7 +202,7 @@ FORECAST_SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = ( ), AccuWeatherSensorDescription( key="WindGustNight", - device_class=SensorDeviceClass.SPEED, + device_class=SensorDeviceClass.WIND_SPEED, icon="mdi:weather-windy", name="Wind gust night", entity_registry_enabled_default=False, @@ -214,7 +214,7 @@ FORECAST_SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = ( ), AccuWeatherSensorDescription( key="WindDay", - device_class=SensorDeviceClass.SPEED, + device_class=SensorDeviceClass.WIND_SPEED, icon="mdi:weather-windy", name="Wind day", unit_fn=lambda metric: SPEED_KILOMETERS_PER_HOUR @@ -225,7 +225,7 @@ FORECAST_SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = ( ), AccuWeatherSensorDescription( key="WindNight", - device_class=SensorDeviceClass.SPEED, + device_class=SensorDeviceClass.WIND_SPEED, icon="mdi:weather-windy", name="Wind night", unit_fn=lambda metric: SPEED_KILOMETERS_PER_HOUR @@ -335,7 +335,7 @@ SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = ( ), AccuWeatherSensorDescription( key="Wind", - device_class=SensorDeviceClass.SPEED, + device_class=SensorDeviceClass.WIND_SPEED, icon="mdi:weather-windy", name="Wind", state_class=SensorStateClass.MEASUREMENT, @@ -346,7 +346,7 @@ SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = ( ), AccuWeatherSensorDescription( key="WindGust", - device_class=SensorDeviceClass.SPEED, + device_class=SensorDeviceClass.WIND_SPEED, icon="mdi:weather-windy", name="Wind gust", entity_registry_enabled_default=False, diff --git a/tests/components/accuweather/test_sensor.py b/tests/components/accuweather/test_sensor.py index aba5c4437ed..55052b5ca3e 100644 --- a/tests/components/accuweather/test_sensor.py +++ b/tests/components/accuweather/test_sensor.py @@ -436,7 +436,7 @@ async def test_sensor_enabled_without_forecast(hass): assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == SPEED_KILOMETERS_PER_HOUR assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy" assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.SPEED + assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED entry = registry.async_get("sensor.home_wind_gust") assert entry @@ -449,7 +449,7 @@ async def test_sensor_enabled_without_forecast(hass): assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == SPEED_KILOMETERS_PER_HOUR assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy" assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.SPEED + assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED entry = registry.async_get("sensor.home_wind") assert entry @@ -582,7 +582,7 @@ async def test_sensor_enabled_without_forecast(hass): assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == SPEED_KILOMETERS_PER_HOUR assert state.attributes.get("direction") == "SSE" assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy" - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.SPEED + assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED entry = registry.async_get("sensor.home_wind_day_0d") assert entry @@ -596,7 +596,7 @@ async def test_sensor_enabled_without_forecast(hass): assert state.attributes.get("direction") == "WNW" assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy" assert state.attributes.get(ATTR_STATE_CLASS) is None - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.SPEED + assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED entry = registry.async_get("sensor.home_wind_night_0d") assert entry @@ -610,7 +610,7 @@ async def test_sensor_enabled_without_forecast(hass): assert state.attributes.get("direction") == "S" assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy" assert state.attributes.get(ATTR_STATE_CLASS) is None - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.SPEED + assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED entry = registry.async_get("sensor.home_wind_gust_day_0d") assert entry @@ -624,7 +624,7 @@ async def test_sensor_enabled_without_forecast(hass): assert state.attributes.get("direction") == "WSW" assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy" assert state.attributes.get(ATTR_STATE_CLASS) is None - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.SPEED + assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WIND_SPEED entry = registry.async_get("sensor.home_wind_gust_night_0d") assert entry