mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use new device class in rfxtrx (#83368)
This commit is contained in:
parent
0c9a78fb8e
commit
d915fd3052
@ -19,17 +19,17 @@ 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,
|
||||||
ELECTRIC_CURRENT_AMPERE,
|
|
||||||
ELECTRIC_POTENTIAL_VOLT,
|
|
||||||
ENERGY_KILO_WATT_HOUR,
|
|
||||||
LENGTH_MILLIMETERS,
|
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
|
||||||
PRESSURE_HPA,
|
|
||||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
SPEED_METERS_PER_SECOND,
|
|
||||||
TEMP_CELSIUS,
|
|
||||||
UV_INDEX,
|
UV_INDEX,
|
||||||
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfElectricPotential,
|
||||||
|
UnitOfEnergy,
|
||||||
|
UnitOfPower,
|
||||||
|
UnitOfPrecipitationDepth,
|
||||||
|
UnitOfPressure,
|
||||||
|
UnitOfSpeed,
|
||||||
|
UnitOfTemperature,
|
||||||
UnitOfVolumetricFlux,
|
UnitOfVolumetricFlux,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -72,7 +72,7 @@ SENSOR_TYPES = (
|
|||||||
name="Barometer",
|
name="Barometer",
|
||||||
device_class=SensorDeviceClass.PRESSURE,
|
device_class=SensorDeviceClass.PRESSURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=PRESSURE_HPA,
|
native_unit_of_measurement=UnitOfPressure.HPA,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Battery numeric",
|
key="Battery numeric",
|
||||||
@ -88,35 +88,35 @@ SENSOR_TYPES = (
|
|||||||
name="Current",
|
name="Current",
|
||||||
device_class=SensorDeviceClass.CURRENT,
|
device_class=SensorDeviceClass.CURRENT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Current Ch. 1",
|
key="Current Ch. 1",
|
||||||
name="Current Ch. 1",
|
name="Current Ch. 1",
|
||||||
device_class=SensorDeviceClass.CURRENT,
|
device_class=SensorDeviceClass.CURRENT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Current Ch. 2",
|
key="Current Ch. 2",
|
||||||
name="Current Ch. 2",
|
name="Current Ch. 2",
|
||||||
device_class=SensorDeviceClass.CURRENT,
|
device_class=SensorDeviceClass.CURRENT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Current Ch. 3",
|
key="Current Ch. 3",
|
||||||
name="Current Ch. 3",
|
name="Current Ch. 3",
|
||||||
device_class=SensorDeviceClass.CURRENT,
|
device_class=SensorDeviceClass.CURRENT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Energy usage",
|
key="Energy usage",
|
||||||
name="Instantaneous power",
|
name="Instantaneous power",
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Humidity",
|
key="Humidity",
|
||||||
@ -139,28 +139,28 @@ SENSOR_TYPES = (
|
|||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Temperature2",
|
key="Temperature2",
|
||||||
name="Temperature 2",
|
name="Temperature 2",
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Total usage",
|
key="Total usage",
|
||||||
name="Total energy usage",
|
name="Total energy usage",
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Voltage",
|
key="Voltage",
|
||||||
name="Voltage",
|
name="Voltage",
|
||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Wind direction",
|
key="Wind direction",
|
||||||
@ -200,27 +200,28 @@ SENSOR_TYPES = (
|
|||||||
name="Chill",
|
name="Chill",
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Wind average speed",
|
key="Wind average speed",
|
||||||
name="Wind average speed",
|
name="Wind average speed",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
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,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Wind gust",
|
key="Wind gust",
|
||||||
name="Wind gust",
|
name="Wind gust",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
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,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Rain total",
|
key="Rain total",
|
||||||
name="Rain total",
|
name="Rain total",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||||
|
device_class=SensorDeviceClass.PRECIPITATION,
|
||||||
),
|
),
|
||||||
RfxtrxSensorEntityDescription(
|
RfxtrxSensorEntityDescription(
|
||||||
key="Forecast",
|
key="Forecast",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user