mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Use SensorDeviceClass.SPEED in components (#79262)
This commit is contained in:
parent
a0357767ef
commit
0e764b57c2
@ -308,6 +308,7 @@ SENSOR_DESCRIPTIONS = (
|
|||||||
name="Max gust",
|
name="Max gust",
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
native_unit_of_measurement=SPEED_MILES_PER_HOUR,
|
native_unit_of_measurement=SPEED_MILES_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
@ -631,6 +632,7 @@ SENSOR_DESCRIPTIONS = (
|
|||||||
name="Wind gust",
|
name="Wind gust",
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
native_unit_of_measurement=SPEED_MILES_PER_HOUR,
|
native_unit_of_measurement=SPEED_MILES_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
@ -638,18 +640,21 @@ SENSOR_DESCRIPTIONS = (
|
|||||||
name="Wind avg 10m",
|
name="Wind avg 10m",
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
native_unit_of_measurement=SPEED_MILES_PER_HOUR,
|
native_unit_of_measurement=SPEED_MILES_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=TYPE_WINDSPDMPH_AVG2M,
|
key=TYPE_WINDSPDMPH_AVG2M,
|
||||||
name="Wind avg 2m",
|
name="Wind avg 2m",
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
native_unit_of_measurement=SPEED_MILES_PER_HOUR,
|
native_unit_of_measurement=SPEED_MILES_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=TYPE_WINDSPEEDMPH,
|
key=TYPE_WINDSPEEDMPH,
|
||||||
name="Wind speed",
|
name="Wind speed",
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
native_unit_of_measurement=SPEED_MILES_PER_HOUR,
|
native_unit_of_measurement=SPEED_MILES_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
@ -138,6 +138,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
key="windspeed",
|
key="windspeed",
|
||||||
name="Wind speed",
|
name="Wind speed",
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -175,6 +176,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
key="windgust",
|
key="windgust",
|
||||||
name="Wind gust",
|
name="Wind gust",
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
@ -463,30 +465,35 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
key="windspeed_1d",
|
key="windspeed_1d",
|
||||||
name="Wind speed 1d",
|
name="Wind speed 1d",
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="windspeed_2d",
|
key="windspeed_2d",
|
||||||
name="Wind speed 2d",
|
name="Wind speed 2d",
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="windspeed_3d",
|
key="windspeed_3d",
|
||||||
name="Wind speed 3d",
|
name="Wind speed 3d",
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="windspeed_4d",
|
key="windspeed_4d",
|
||||||
name="Wind speed 4d",
|
name="Wind speed 4d",
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="windspeed_5d",
|
key="windspeed_5d",
|
||||||
name="Wind speed 5d",
|
name="Wind speed 5d",
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
@ -198,6 +198,7 @@ SENSOR_TYPES: tuple[ECSensorEntityDescription, ...] = (
|
|||||||
key="wind_gust",
|
key="wind_gust",
|
||||||
name="Wind gust",
|
name="Wind gust",
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_fn=lambda data: data.conditions.get("wind_gust", {}).get("value"),
|
value_fn=lambda data: data.conditions.get("wind_gust", {}).get("value"),
|
||||||
),
|
),
|
||||||
@ -205,6 +206,7 @@ SENSOR_TYPES: tuple[ECSensorEntityDescription, ...] = (
|
|||||||
key="wind_speed",
|
key="wind_speed",
|
||||||
name="Wind speed",
|
name="Wind speed",
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_fn=lambda data: data.conditions.get("wind_speed", {}).get("value"),
|
value_fn=lambda data: data.conditions.get("wind_speed", {}).get("value"),
|
||||||
),
|
),
|
||||||
|
@ -170,6 +170,7 @@ SENSOR_DESCRIPTIONS: dict[str, SensorEntityDescription] = {
|
|||||||
"WIND_SPEED": SensorEntityDescription(
|
"WIND_SPEED": SensorEntityDescription(
|
||||||
key="WIND_SPEED",
|
key="WIND_SPEED",
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
),
|
),
|
||||||
"WIND_DIRECTION": SensorEntityDescription(
|
"WIND_DIRECTION": SensorEntityDescription(
|
||||||
|
@ -344,6 +344,8 @@ class HomematicipEnergySensor(HomematicipGenericEntity, SensorEntity):
|
|||||||
class HomematicipWindspeedSensor(HomematicipGenericEntity, SensorEntity):
|
class HomematicipWindspeedSensor(HomematicipGenericEntity, SensorEntity):
|
||||||
"""Representation of the HomematicIP wind speed sensor."""
|
"""Representation of the HomematicIP wind speed sensor."""
|
||||||
|
|
||||||
|
_attr_device_class = SensorDeviceClass.SPEED
|
||||||
|
|
||||||
def __init__(self, hap: HomematicipHAP, device) -> None:
|
def __init__(self, hap: HomematicipHAP, device) -> None:
|
||||||
"""Initialize the windspeed sensor."""
|
"""Initialize the windspeed sensor."""
|
||||||
super().__init__(hap, device, post="Windspeed")
|
super().__init__(hap, device, post="Windspeed")
|
||||||
|
@ -81,6 +81,7 @@ SENSOR_DESCRIPTIONS = {
|
|||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_fn=get_value,
|
value_fn=get_value,
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
),
|
),
|
||||||
"Rain": LaCrosseSensorEntityDescription(
|
"Rain": LaCrosseSensorEntityDescription(
|
||||||
key="Rain",
|
key="Rain",
|
||||||
|
@ -200,6 +200,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
|||||||
netatmo_name="wind_strength",
|
netatmo_name="wind_strength",
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -225,6 +226,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
|||||||
netatmo_name="gust_strength",
|
netatmo_name="gust_strength",
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
@ -76,12 +76,14 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
|||||||
key=SENSOR_TYPE_WINDAVERAGE,
|
key=SENSOR_TYPE_WINDAVERAGE,
|
||||||
name="Wind average",
|
name="Wind average",
|
||||||
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SENSOR_TYPE_WINDGUST: SensorEntityDescription(
|
SENSOR_TYPE_WINDGUST: SensorEntityDescription(
|
||||||
key=SENSOR_TYPE_WINDGUST,
|
key=SENSOR_TYPE_WINDGUST,
|
||||||
name="Wind gust",
|
name="Wind gust",
|
||||||
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SENSOR_TYPE_UV: SensorEntityDescription(
|
SENSOR_TYPE_UV: SensorEntityDescription(
|
||||||
|
@ -89,6 +89,7 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
|||||||
api_key="windforce",
|
api_key="windforce",
|
||||||
name="Wind speed",
|
name="Wind speed",
|
||||||
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -97,6 +98,7 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
|||||||
api_key="windforcemax",
|
api_key="windforcemax",
|
||||||
name="Wind speed max",
|
name="Wind speed max",
|
||||||
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
||||||
|
device_class=SensorDeviceClass.SPEED,
|
||||||
icon="mdi:weather-windy-variant",
|
icon="mdi:weather-windy-variant",
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user