mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Use new device class in trafikverket weatherstation (#83370)
This commit is contained in:
parent
11609a63e3
commit
9856a811ae
@ -13,10 +13,10 @@ from homeassistant.components.sensor import (
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
DEGREE,
|
DEGREE,
|
||||||
LENGTH_MILLIMETERS,
|
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
SPEED_METERS_PER_SECOND,
|
UnitOfPrecipitationDepth,
|
||||||
TEMP_CELSIUS,
|
UnitOfSpeed,
|
||||||
|
UnitOfTemperature,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.device_registry import DeviceEntryType
|
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||||
@ -49,8 +49,7 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
|||||||
key="air_temp",
|
key="air_temp",
|
||||||
api_key="air_temp",
|
api_key="air_temp",
|
||||||
name="Air temperature",
|
name="Air temperature",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
icon="mdi:thermometer",
|
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -58,8 +57,7 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
|||||||
key="road_temp",
|
key="road_temp",
|
||||||
api_key="road_temp",
|
api_key="road_temp",
|
||||||
name="Road temperature",
|
name="Road temperature",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
icon="mdi:thermometer",
|
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -88,17 +86,16 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
|||||||
key="wind_speed",
|
key="wind_speed",
|
||||||
api_key="windforce",
|
api_key="windforce",
|
||||||
name="Wind speed",
|
name="Wind speed",
|
||||||
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND,
|
||||||
device_class=SensorDeviceClass.SPEED,
|
device_class=SensorDeviceClass.WIND_SPEED,
|
||||||
icon="mdi:weather-windy",
|
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="wind_speed_max",
|
key="wind_speed_max",
|
||||||
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=UnitOfSpeed.METERS_PER_SECOND,
|
||||||
device_class=SensorDeviceClass.SPEED,
|
device_class=SensorDeviceClass.WIND_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,
|
||||||
@ -117,8 +114,8 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
|||||||
key="precipitation_amount",
|
key="precipitation_amount",
|
||||||
api_key="precipitation_amount",
|
api_key="precipitation_amount",
|
||||||
name="Precipitation amount",
|
name="Precipitation amount",
|
||||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||||
icon="mdi:cup-water",
|
device_class=SensorDeviceClass.PRECIPITATION,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user