diff --git a/homeassistant/components/ambient_station/sensor.py b/homeassistant/components/ambient_station/sensor.py index a849550a6ee..eb01fd379b2 100644 --- a/homeassistant/components/ambient_station/sensor.py +++ b/homeassistant/components/ambient_station/sensor.py @@ -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( diff --git a/homeassistant/components/homekit/accessories.py b/homeassistant/components/homekit/accessories.py index e91a710e4fe..adab539fb30 100644 --- a/homeassistant/components/homekit/accessories.py +++ b/homeassistant/components/homekit/accessories.py @@ -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": diff --git a/homeassistant/components/number/__init__.py b/homeassistant/components/number/__init__.py index 2f5ebc662a3..5a48d00d4da 100644 --- a/homeassistant/components/number/__init__.py +++ b/homeassistant/components/number/__init__.py @@ -143,7 +143,7 @@ class NumberDeviceClass(StrEnum): ILLUMINANCE = "illuminance" """Illuminance. - Unit of measurement: `lx`, `lm` + Unit of measurement: `lx` """ IRRADIANCE = "irradiance" diff --git a/homeassistant/components/plugwise/sensor.py b/homeassistant/components/plugwise/sensor.py index d727d611d61..91fd32c92c2 100644 --- a/homeassistant/components/plugwise/sensor.py +++ b/homeassistant/components/plugwise/sensor.py @@ -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( diff --git a/homeassistant/components/sensor/__init__.py b/homeassistant/components/sensor/__init__.py index fc6f0b60815..9adc1f74cac 100644 --- a/homeassistant/components/sensor/__init__.py +++ b/homeassistant/components/sensor/__init__.py @@ -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}, diff --git a/homeassistant/components/switchbot/sensor.py b/homeassistant/components/switchbot/sensor.py index 342328d470e..f31f7486b72 100644 --- a/homeassistant/components/switchbot/sensor.py +++ b/homeassistant/components/switchbot/sensor.py @@ -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", diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index 3d325ea48ee..75ccffce685 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -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³"}, diff --git a/homeassistant/components/xiaomi_aqara/sensor.py b/homeassistant/components/xiaomi_aqara/sensor.py index 54ac3db120f..e114adaa8c4 100644 --- a/homeassistant/components/xiaomi_aqara/sensor.py +++ b/homeassistant/components/xiaomi_aqara/sensor.py @@ -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( diff --git a/homeassistant/components/xiaomi_miio/sensor.py b/homeassistant/components/xiaomi_miio/sensor.py index 3630f3b807a..13344e5044a 100644 --- a/homeassistant/components/xiaomi_miio/sensor.py +++ b/homeassistant/components/xiaomi_miio/sensor.py @@ -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( diff --git a/tests/components/homekit/test_get_accessories.py b/tests/components/homekit/test_get_accessories.py index 12113ada5cb..320407f480a 100644 --- a/tests/components/homekit/test_get_accessories.py +++ b/tests/components/homekit/test_get_accessories.py @@ -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", diff --git a/tests/testing_config/custom_components/test/sensor.py b/tests/testing_config/custom_components/test/sensor.py index 9ec56ad23f6..9b3911313a6 100644 --- a/tests/testing_config/custom_components/test/sensor.py +++ b/tests/testing_config/custom_components/test/sensor.py @@ -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