Use new device class in rfxtrx (#83368)

This commit is contained in:
epenet 2022-12-06 10:09:03 +01:00 committed by GitHub
parent 0c9a78fb8e
commit d915fd3052
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,17 +19,17 @@ from homeassistant.components.sensor import (
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEGREE,
ELECTRIC_CURRENT_AMPERE,
ELECTRIC_POTENTIAL_VOLT,
ENERGY_KILO_WATT_HOUR,
LENGTH_MILLIMETERS,
PERCENTAGE,
POWER_WATT,
PRESSURE_HPA,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
SPEED_METERS_PER_SECOND,
TEMP_CELSIUS,
UV_INDEX,
UnitOfElectricCurrent,
UnitOfElectricPotential,
UnitOfEnergy,
UnitOfPower,
UnitOfPrecipitationDepth,
UnitOfPressure,
UnitOfSpeed,
UnitOfTemperature,
UnitOfVolumetricFlux,
)
from homeassistant.core import HomeAssistant, callback
@ -72,7 +72,7 @@ SENSOR_TYPES = (
name="Barometer",
device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PRESSURE_HPA,
native_unit_of_measurement=UnitOfPressure.HPA,
),
RfxtrxSensorEntityDescription(
key="Battery numeric",
@ -88,35 +88,35 @@ SENSOR_TYPES = (
name="Current",
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
),
RfxtrxSensorEntityDescription(
key="Current Ch. 1",
name="Current Ch. 1",
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
),
RfxtrxSensorEntityDescription(
key="Current Ch. 2",
name="Current Ch. 2",
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
),
RfxtrxSensorEntityDescription(
key="Current Ch. 3",
name="Current Ch. 3",
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
),
RfxtrxSensorEntityDescription(
key="Energy usage",
name="Instantaneous power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
),
RfxtrxSensorEntityDescription(
key="Humidity",
@ -139,28 +139,28 @@ SENSOR_TYPES = (
name="Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
),
RfxtrxSensorEntityDescription(
key="Temperature2",
name="Temperature 2",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
),
RfxtrxSensorEntityDescription(
key="Total usage",
name="Total energy usage",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
),
RfxtrxSensorEntityDescription(
key="Voltage",
name="Voltage",
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
),
RfxtrxSensorEntityDescription(
key="Wind direction",
@ -200,27 +200,28 @@ SENSOR_TYPES = (
name="Chill",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
),
RfxtrxSensorEntityDescription(
key="Wind average speed",
name="Wind average speed",
state_class=SensorStateClass.MEASUREMENT,
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,
),
RfxtrxSensorEntityDescription(
key="Wind gust",
name="Wind gust",
state_class=SensorStateClass.MEASUREMENT,
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,
),
RfxtrxSensorEntityDescription(
key="Rain total",
name="Rain total",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=LENGTH_MILLIMETERS,
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
device_class=SensorDeviceClass.PRECIPITATION,
),
RfxtrxSensorEntityDescription(
key="Forecast",