Remove lumen from Illuminance units (#84386)
parent
2215adf5cf
commit
4c8e3aa7c4
|
@ -592,7 +592,6 @@ SENSOR_DESCRIPTIONS = (
|
|||
key=TYPE_UV,
|
||||
name="UV index",
|
||||
native_unit_of_measurement="Index",
|
||||
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
|
|
|
@ -214,7 +214,7 @@ def get_accessory( # noqa: C901
|
|||
a_type = "CarbonMonoxideSensor"
|
||||
elif device_class == SensorDeviceClass.CO2 or "co2" in state.entity_id:
|
||||
a_type = "CarbonDioxideSensor"
|
||||
elif device_class == SensorDeviceClass.ILLUMINANCE or unit in ("lm", LIGHT_LUX):
|
||||
elif device_class == SensorDeviceClass.ILLUMINANCE or unit == LIGHT_LUX:
|
||||
a_type = "LightSensor"
|
||||
|
||||
elif state.domain == "switch":
|
||||
|
|
|
@ -143,7 +143,7 @@ class NumberDeviceClass(StrEnum):
|
|||
ILLUMINANCE = "illuminance"
|
||||
"""Illuminance.
|
||||
|
||||
Unit of measurement: `lx`, `lm`
|
||||
Unit of measurement: `lx`
|
||||
"""
|
||||
|
||||
IRRADIANCE = "irradiance"
|
||||
|
|
|
@ -258,7 +258,6 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||
key="illuminance",
|
||||
name="Illuminance",
|
||||
native_unit_of_measurement=UNIT_LUMEN,
|
||||
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
|
|
|
@ -235,7 +235,7 @@ class SensorDeviceClass(StrEnum):
|
|||
ILLUMINANCE = "illuminance"
|
||||
"""Illuminance.
|
||||
|
||||
Unit of measurement: `lx`, `lm`
|
||||
Unit of measurement: `lx`
|
||||
"""
|
||||
|
||||
IRRADIANCE = "irradiance"
|
||||
|
@ -503,7 +503,7 @@ DEVICE_CLASS_UNITS: dict[SensorDeviceClass, set[type[StrEnum] | str | None]] = {
|
|||
UnitOfVolume.CUBIC_METERS,
|
||||
},
|
||||
SensorDeviceClass.HUMIDITY: {PERCENTAGE},
|
||||
SensorDeviceClass.ILLUMINANCE: {LIGHT_LUX, "lm"},
|
||||
SensorDeviceClass.ILLUMINANCE: {LIGHT_LUX},
|
||||
SensorDeviceClass.IRRADIANCE: set(UnitOfIrradiance),
|
||||
SensorDeviceClass.MOISTURE: {PERCENTAGE},
|
||||
SensorDeviceClass.NITROGEN_DIOXIDE: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
|
|
|
@ -57,7 +57,6 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
|||
name="Light level",
|
||||
native_unit_of_measurement="Level",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||
),
|
||||
"humidity": SensorEntityDescription(
|
||||
key="humidity",
|
||||
|
|
|
@ -456,11 +456,6 @@ UNITS = (
|
|||
aliases={"lux"},
|
||||
device_classes={SensorDeviceClass.ILLUMINANCE},
|
||||
),
|
||||
UnitOfMeasurement(
|
||||
unit="lm",
|
||||
aliases={"lum", "lumen"},
|
||||
device_classes={SensorDeviceClass.ILLUMINANCE},
|
||||
),
|
||||
UnitOfMeasurement(
|
||||
unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
aliases={"ug/m3", "µg/m3", "ug/m³"},
|
||||
|
|
|
@ -42,7 +42,6 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
|||
"illumination": SensorEntityDescription(
|
||||
key="illumination",
|
||||
native_unit_of_measurement="lm",
|
||||
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
"lux": SensorEntityDescription(
|
||||
|
|
|
@ -246,7 +246,6 @@ SENSOR_TYPES = {
|
|||
key=ATTR_ILLUMINANCE,
|
||||
name="Illuminance",
|
||||
native_unit_of_measurement=UNIT_LUMEN,
|
||||
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
ATTR_ILLUMINANCE_LUX: XiaomiMiioSensorDescription(
|
||||
|
|
|
@ -258,7 +258,6 @@ def test_type_media_player(type_name, entity_id, state, attrs, config):
|
|||
{ATTR_DEVICE_CLASS: "humidity", ATTR_UNIT_OF_MEASUREMENT: PERCENTAGE},
|
||||
),
|
||||
("LightSensor", "sensor.light", "900", {ATTR_DEVICE_CLASS: "illuminance"}),
|
||||
("LightSensor", "sensor.light", "900", {ATTR_UNIT_OF_MEASUREMENT: "lm"}),
|
||||
("LightSensor", "sensor.light", "900", {ATTR_UNIT_OF_MEASUREMENT: LIGHT_LUX}),
|
||||
(
|
||||
"TemperatureSensor",
|
||||
|
|
|
@ -13,6 +13,7 @@ from homeassistant.const import (
|
|||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
FREQUENCY_GIGAHERTZ,
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
POWER_VOLT_AMPERE,
|
||||
POWER_VOLT_AMPERE_REACTIVE,
|
||||
|
@ -31,7 +32,7 @@ UNITS_OF_MEASUREMENT = {
|
|||
SensorDeviceClass.CO: CONCENTRATION_PARTS_PER_MILLION, # ppm of CO concentration
|
||||
SensorDeviceClass.CO2: CONCENTRATION_PARTS_PER_MILLION, # ppm of CO2 concentration
|
||||
SensorDeviceClass.HUMIDITY: PERCENTAGE, # % of humidity in the air
|
||||
SensorDeviceClass.ILLUMINANCE: "lm", # current light level (lx/lm)
|
||||
SensorDeviceClass.ILLUMINANCE: LIGHT_LUX, # current light level lx
|
||||
SensorDeviceClass.MOISTURE: PERCENTAGE, # % of water in a substance
|
||||
SensorDeviceClass.NITROGEN_DIOXIDE: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, # µg/m³ of nitrogen dioxide
|
||||
SensorDeviceClass.NITROGEN_MONOXIDE: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, # µg/m³ of nitrogen monoxide
|
||||
|
|
Loading…
Reference in New Issue