Use new device class in buienradar (#83363)
This commit is contained in:
parent
c2da664bcc
commit
d1bbd241aa
1 changed files with 70 additions and 77 deletions
|
@ -35,12 +35,12 @@ from homeassistant.const import (
|
|||
CONF_NAME,
|
||||
DEGREE,
|
||||
IRRADIATION_WATTS_PER_SQUARE_METER,
|
||||
LENGTH_KILOMETERS,
|
||||
LENGTH_MILLIMETERS,
|
||||
PERCENTAGE,
|
||||
PRESSURE_HPA,
|
||||
SPEED_KILOMETERS_PER_HOUR,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfLength,
|
||||
UnitOfPrecipitationDepth,
|
||||
UnitOfPressure,
|
||||
UnitOfSpeed,
|
||||
UnitOfTemperature,
|
||||
UnitOfVolumetricFlux,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
|
@ -110,7 +110,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||
SensorEntityDescription(
|
||||
key="feeltemperature",
|
||||
name="Feel temperature",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
|
@ -123,23 +123,22 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||
SensorEntityDescription(
|
||||
key="temperature",
|
||||
name="Temperature",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="groundtemperature",
|
||||
name="Ground temperature",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="windspeed",
|
||||
name="Wind speed",
|
||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.WIND_SPEED,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
|
@ -162,23 +161,22 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||
SensorEntityDescription(
|
||||
key="pressure",
|
||||
name="Pressure",
|
||||
native_unit_of_measurement=PRESSURE_HPA,
|
||||
native_unit_of_measurement=UnitOfPressure.HPA,
|
||||
icon="mdi:gauge",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="visibility",
|
||||
name="Visibility",
|
||||
native_unit_of_measurement=LENGTH_KILOMETERS,
|
||||
native_unit_of_measurement=UnitOfLength.KILOMETERS,
|
||||
device_class=SensorDeviceClass.DISTANCE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="windgust",
|
||||
name="Wind gust",
|
||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.WIND_SPEED,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="precipitation",
|
||||
|
@ -203,174 +201,174 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||
SensorEntityDescription(
|
||||
key="precipitation_forecast_total",
|
||||
name="Precipitation forecast total",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
# new in json api (>1.0.0):
|
||||
SensorEntityDescription(
|
||||
key="rainlast24hour",
|
||||
name="Rain last 24h",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
# new in json api (>1.0.0):
|
||||
SensorEntityDescription(
|
||||
key="rainlasthour",
|
||||
name="Rain last hour",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="temperature_1d",
|
||||
name="Temperature 1d",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="temperature_2d",
|
||||
name="Temperature 2d",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="temperature_3d",
|
||||
name="Temperature 3d",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="temperature_4d",
|
||||
name="Temperature 4d",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="temperature_5d",
|
||||
name="Temperature 5d",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="mintemp_1d",
|
||||
name="Minimum temperature 1d",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="mintemp_2d",
|
||||
name="Minimum temperature 2d",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="mintemp_3d",
|
||||
name="Minimum temperature 3d",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="mintemp_4d",
|
||||
name="Minimum temperature 4d",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="mintemp_5d",
|
||||
name="Minimum temperature 5d",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="rain_1d",
|
||||
name="Rain 1d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="rain_2d",
|
||||
name="Rain 2d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="rain_3d",
|
||||
name="Rain 3d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="rain_4d",
|
||||
name="Rain 4d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="rain_5d",
|
||||
name="Rain 5d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
# new in json api (>1.0.0):
|
||||
SensorEntityDescription(
|
||||
key="minrain_1d",
|
||||
name="Minimum rain 1d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="minrain_2d",
|
||||
name="Minimum rain 2d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="minrain_3d",
|
||||
name="Minimum rain 3d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="minrain_4d",
|
||||
name="Minimum rain 4d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="minrain_5d",
|
||||
name="Minimum rain 5d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
# new in json api (>1.0.0):
|
||||
SensorEntityDescription(
|
||||
key="maxrain_1d",
|
||||
name="Maximum rain 1d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="maxrain_2d",
|
||||
name="Maximum rain 2d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="maxrain_3d",
|
||||
name="Maximum rain 3d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="maxrain_4d",
|
||||
name="Maximum rain 4d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="maxrain_5d",
|
||||
name="Maximum rain 5d",
|
||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||
icon="mdi:weather-pouring",
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="rainchance_1d",
|
||||
|
@ -465,37 +463,32 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||
SensorEntityDescription(
|
||||
key="windspeed_1d",
|
||||
name="Wind speed 1d",
|
||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.WIND_SPEED,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="windspeed_2d",
|
||||
name="Wind speed 2d",
|
||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.WIND_SPEED,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="windspeed_3d",
|
||||
name="Wind speed 3d",
|
||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.WIND_SPEED,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="windspeed_4d",
|
||||
name="Wind speed 4d",
|
||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.WIND_SPEED,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="windspeed_5d",
|
||||
name="Wind speed 5d",
|
||||
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.SPEED,
|
||||
icon="mdi:weather-windy",
|
||||
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.WIND_SPEED,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="winddirection_1d",
|
||||
|
|
Loading…
Add table
Reference in a new issue