diff --git a/homeassistant/components/trafikverket_weatherstation/sensor.py b/homeassistant/components/trafikverket_weatherstation/sensor.py index 4053ce7cbc4..d50ba66d8e0 100644 --- a/homeassistant/components/trafikverket_weatherstation/sensor.py +++ b/homeassistant/components/trafikverket_weatherstation/sensor.py @@ -13,10 +13,10 @@ from homeassistant.components.sensor import ( from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( DEGREE, - LENGTH_MILLIMETERS, PERCENTAGE, - SPEED_METERS_PER_SECOND, - TEMP_CELSIUS, + UnitOfPrecipitationDepth, + UnitOfSpeed, + UnitOfTemperature, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.device_registry import DeviceEntryType @@ -49,8 +49,7 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = ( key="air_temp", api_key="air_temp", name="Air temperature", - native_unit_of_measurement=TEMP_CELSIUS, - icon="mdi:thermometer", + native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), @@ -58,8 +57,7 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = ( key="road_temp", api_key="road_temp", name="Road temperature", - native_unit_of_measurement=TEMP_CELSIUS, - icon="mdi:thermometer", + native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), @@ -88,17 +86,16 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = ( key="wind_speed", api_key="windforce", name="Wind speed", - native_unit_of_measurement=SPEED_METERS_PER_SECOND, - device_class=SensorDeviceClass.SPEED, - icon="mdi:weather-windy", + native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND, + device_class=SensorDeviceClass.WIND_SPEED, state_class=SensorStateClass.MEASUREMENT, ), TrafikverketSensorEntityDescription( key="wind_speed_max", api_key="windforcemax", name="Wind speed max", - native_unit_of_measurement=SPEED_METERS_PER_SECOND, - device_class=SensorDeviceClass.SPEED, + native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND, + device_class=SensorDeviceClass.WIND_SPEED, icon="mdi:weather-windy-variant", entity_registry_enabled_default=False, state_class=SensorStateClass.MEASUREMENT, @@ -117,8 +114,8 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = ( key="precipitation_amount", api_key="precipitation_amount", name="Precipitation amount", - native_unit_of_measurement=LENGTH_MILLIMETERS, - icon="mdi:cup-water", + native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + device_class=SensorDeviceClass.PRECIPITATION, state_class=SensorStateClass.MEASUREMENT, ), TrafikverketSensorEntityDescription(