Use new device class in zamg (#83361)

pull/83546/head
epenet 2022-12-06 10:56:23 +01:00 committed by GitHub
parent 8a1a341b3a
commit a3c4996291
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 17 deletions

View File

@ -21,13 +21,12 @@ from homeassistant.const import (
CONF_MONITORED_CONDITIONS, CONF_MONITORED_CONDITIONS,
CONF_NAME, CONF_NAME,
DEGREE, DEGREE,
LENGTH_CENTIMETERS,
LENGTH_MILLIMETERS,
PERCENTAGE, PERCENTAGE,
PRESSURE_HPA, UnitOfPrecipitationDepth,
SPEED_METERS_PER_SECOND, UnitOfPressure,
TEMP_CELSIUS, UnitOfSpeed,
TIME_SECONDS, UnitOfTemperature,
UnitOfTime,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -67,7 +66,7 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="pressure", key="pressure",
name="Pressure", name="Pressure",
native_unit_of_measurement=PRESSURE_HPA, native_unit_of_measurement=UnitOfPressure.HPA,
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="P", para_name="P",
@ -76,7 +75,7 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="pressure_sealevel", key="pressure_sealevel",
name="Pressure at Sea Level", name="Pressure at Sea Level",
native_unit_of_measurement=PRESSURE_HPA, native_unit_of_measurement=UnitOfPressure.HPA,
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="PRED", para_name="PRED",
@ -94,7 +93,8 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="wind_speed", key="wind_speed",
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.WIND_SPEED,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="FFAM", para_name="FFAM",
dtype=float, dtype=float,
@ -110,7 +110,8 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="wind_max_speed", key="wind_max_speed",
name="Top Wind Speed", name="Top Wind Speed",
native_unit_of_measurement=SPEED_METERS_PER_SECOND, native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND,
device_class=SensorDeviceClass.WIND_SPEED,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="FFX", para_name="FFX",
dtype=float, dtype=float,
@ -126,7 +127,7 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="sun_last_10min", key="sun_last_10min",
name="Sun Last 10 Minutes", name="Sun Last 10 Minutes",
native_unit_of_measurement=TIME_SECONDS, native_unit_of_measurement=UnitOfTime.SECONDS,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="SO", para_name="SO",
dtype=int, dtype=int,
@ -134,7 +135,7 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="temperature", key="temperature",
name="Temperature", name="Temperature",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="TL", para_name="TL",
@ -143,7 +144,7 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="temperature_average", key="temperature_average",
name="Temperature Average", name="Temperature Average",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="TLAM", para_name="TLAM",
@ -152,7 +153,8 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="precipitation", key="precipitation",
name="Precipitation", name="Precipitation",
native_unit_of_measurement=LENGTH_MILLIMETERS, native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="RR", para_name="RR",
dtype=float, dtype=float,
@ -160,7 +162,8 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="snow", key="snow",
name="Snow", name="Snow",
native_unit_of_measurement=LENGTH_CENTIMETERS, native_unit_of_measurement=UnitOfPrecipitationDepth.CENTIMETERS,
device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="SCHNEE", para_name="SCHNEE",
dtype=float, dtype=float,
@ -168,7 +171,7 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="dewpoint", key="dewpoint",
name="Dew Point", name="Dew Point",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="TP", para_name="TP",
@ -177,7 +180,7 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
ZamgSensorEntityDescription( ZamgSensorEntityDescription(
key="dewpoint_average", key="dewpoint_average",
name="Dew Point Average", name="Dew Point Average",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
para_name="TPAM", para_name="TPAM",