Use new device classes in Accuweather integration (#79717)
* Add new device classes * Update tests
This commit is contained in:
parent
24e9f6285d
commit
5abff31437
2 changed files with 14 additions and 0 deletions
|
@ -189,6 +189,7 @@ FORECAST_SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = (
|
|||
),
|
||||
AccuWeatherSensorDescription(
|
||||
key="WindGustDay",
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
name="Wind gust day",
|
||||
entity_registry_enabled_default=False,
|
||||
|
@ -200,6 +201,7 @@ FORECAST_SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = (
|
|||
),
|
||||
AccuWeatherSensorDescription(
|
||||
key="WindGustNight",
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
name="Wind gust night",
|
||||
entity_registry_enabled_default=False,
|
||||
|
@ -211,6 +213,7 @@ FORECAST_SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = (
|
|||
),
|
||||
AccuWeatherSensorDescription(
|
||||
key="WindDay",
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
name="Wind day",
|
||||
unit_fn=lambda metric: SPEED_KILOMETERS_PER_HOUR
|
||||
|
@ -221,6 +224,7 @@ FORECAST_SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = (
|
|||
),
|
||||
AccuWeatherSensorDescription(
|
||||
key="WindNight",
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
name="Wind night",
|
||||
unit_fn=lambda metric: SPEED_KILOMETERS_PER_HOUR
|
||||
|
@ -243,6 +247,7 @@ SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = (
|
|||
),
|
||||
AccuWeatherSensorDescription(
|
||||
key="Ceiling",
|
||||
device_class=SensorDeviceClass.DISTANCE,
|
||||
icon="mdi:weather-fog",
|
||||
name="Cloud ceiling",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -329,6 +334,7 @@ SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = (
|
|||
),
|
||||
AccuWeatherSensorDescription(
|
||||
key="Wind",
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
name="Wind",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -339,6 +345,7 @@ SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = (
|
|||
),
|
||||
AccuWeatherSensorDescription(
|
||||
key="WindGust",
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
name="Wind gust",
|
||||
entity_registry_enabled_default=False,
|
||||
|
|
|
@ -49,6 +49,7 @@ async def test_sensor_without_forecast(hass):
|
|||
assert state.attributes.get(ATTR_ICON) == "mdi:weather-fog"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == LENGTH_METERS
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.DISTANCE
|
||||
|
||||
entry = registry.async_get("sensor.home_cloud_ceiling")
|
||||
assert entry
|
||||
|
@ -435,6 +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
|
||||
|
||||
entry = registry.async_get("sensor.home_wind_gust")
|
||||
assert entry
|
||||
|
@ -447,6 +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
|
||||
|
||||
entry = registry.async_get("sensor.home_wind")
|
||||
assert entry
|
||||
|
@ -579,6 +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
|
||||
|
||||
entry = registry.async_get("sensor.home_wind_day_0d")
|
||||
assert entry
|
||||
|
@ -592,6 +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
|
||||
|
||||
entry = registry.async_get("sensor.home_wind_night_0d")
|
||||
assert entry
|
||||
|
@ -605,6 +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
|
||||
|
||||
entry = registry.async_get("sensor.home_wind_gust_day_0d")
|
||||
assert entry
|
||||
|
@ -618,6 +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
|
||||
|
||||
entry = registry.async_get("sensor.home_wind_gust_night_0d")
|
||||
assert entry
|
||||
|
|
Loading…
Add table
Reference in a new issue