mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Use Irradiance unit and device class in integrations (#83576)
This commit is contained in:
parent
7f345e7672
commit
911863ebf4
@ -15,9 +15,9 @@ from homeassistant.const import (
|
|||||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
DEGREE,
|
DEGREE,
|
||||||
IRRADIATION_WATTS_PER_SQUARE_METER,
|
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
|
UnitOfIrradiance,
|
||||||
UnitOfPrecipitationDepth,
|
UnitOfPrecipitationDepth,
|
||||||
UnitOfPressure,
|
UnitOfPressure,
|
||||||
UnitOfSpeed,
|
UnitOfSpeed,
|
||||||
@ -486,8 +486,8 @@ SENSOR_DESCRIPTIONS = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=TYPE_SOLARRADIATION,
|
key=TYPE_SOLARRADIATION,
|
||||||
name="Solar rad",
|
name="Solar rad",
|
||||||
native_unit_of_measurement=IRRADIATION_WATTS_PER_SQUARE_METER,
|
native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER,
|
||||||
device_class=SensorDeviceClass.ILLUMINANCE,
|
device_class=SensorDeviceClass.IRRADIANCE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
@ -34,8 +34,8 @@ from homeassistant.const import (
|
|||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
DEGREE,
|
DEGREE,
|
||||||
IRRADIATION_WATTS_PER_SQUARE_METER,
|
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
|
UnitOfIrradiance,
|
||||||
UnitOfLength,
|
UnitOfLength,
|
||||||
UnitOfPrecipitationDepth,
|
UnitOfPrecipitationDepth,
|
||||||
UnitOfPressure,
|
UnitOfPressure,
|
||||||
@ -188,8 +188,8 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="irradiance",
|
key="irradiance",
|
||||||
name="Irradiance",
|
name="Irradiance",
|
||||||
native_unit_of_measurement=IRRADIATION_WATTS_PER_SQUARE_METER,
|
device_class=SensorDeviceClass.IRRADIANCE,
|
||||||
icon="mdi:sunglasses",
|
native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
@ -18,11 +18,11 @@ from homeassistant.const import (
|
|||||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
DEGREE,
|
DEGREE,
|
||||||
IRRADIATION_WATTS_PER_SQUARE_METER,
|
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
UV_INDEX,
|
UV_INDEX,
|
||||||
UnitOfElectricPotential,
|
UnitOfElectricPotential,
|
||||||
|
UnitOfIrradiance,
|
||||||
UnitOfLength,
|
UnitOfLength,
|
||||||
UnitOfPrecipitationDepth,
|
UnitOfPrecipitationDepth,
|
||||||
UnitOfPressure,
|
UnitOfPressure,
|
||||||
@ -68,7 +68,8 @@ ECOWITT_SENSORS_MAPPING: Final = {
|
|||||||
),
|
),
|
||||||
EcoWittSensorTypes.WATT_METERS_SQUARED: SensorEntityDescription(
|
EcoWittSensorTypes.WATT_METERS_SQUARED: SensorEntityDescription(
|
||||||
key="WATT_METERS_SQUARED",
|
key="WATT_METERS_SQUARED",
|
||||||
native_unit_of_measurement=IRRADIATION_WATTS_PER_SQUARE_METER,
|
device_class=SensorDeviceClass.IRRADIANCE,
|
||||||
|
native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
EcoWittSensorTypes.UV_INDEX: SensorEntityDescription(
|
EcoWittSensorTypes.UV_INDEX: SensorEntityDescription(
|
||||||
|
@ -98,7 +98,6 @@ from homeassistant.const import (
|
|||||||
ELECTRIC_POTENTIAL_VOLT,
|
ELECTRIC_POTENTIAL_VOLT,
|
||||||
FREQUENCY_HERTZ,
|
FREQUENCY_HERTZ,
|
||||||
FREQUENCY_KILOHERTZ,
|
FREQUENCY_KILOHERTZ,
|
||||||
IRRADIATION_WATTS_PER_SQUARE_METER,
|
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
SIGNAL_STRENGTH_DECIBELS,
|
SIGNAL_STRENGTH_DECIBELS,
|
||||||
@ -107,6 +106,7 @@ from homeassistant.const import (
|
|||||||
VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE,
|
VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE,
|
||||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||||
UnitOfEnergy,
|
UnitOfEnergy,
|
||||||
|
UnitOfIrradiance,
|
||||||
UnitOfLength,
|
UnitOfLength,
|
||||||
UnitOfMass,
|
UnitOfMass,
|
||||||
UnitOfPower,
|
UnitOfPower,
|
||||||
@ -209,7 +209,7 @@ MULTILEVEL_SENSOR_UNIT_MAP: dict[str, set[MultilevelSensorScaleType]] = {
|
|||||||
UnitOfPressure.MMHG: UNIT_SYSTOLIC,
|
UnitOfPressure.MMHG: UNIT_SYSTOLIC,
|
||||||
ELECTRIC_POTENTIAL_VOLT: SENSOR_UNIT_VOLT,
|
ELECTRIC_POTENTIAL_VOLT: SENSOR_UNIT_VOLT,
|
||||||
UnitOfPower.WATT: SENSOR_UNIT_WATT,
|
UnitOfPower.WATT: SENSOR_UNIT_WATT,
|
||||||
IRRADIATION_WATTS_PER_SQUARE_METER: UNIT_WATT_PER_SQUARE_METER,
|
UnitOfIrradiance.WATTS_PER_SQUARE_METER: UNIT_WATT_PER_SQUARE_METER,
|
||||||
}
|
}
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user