Add missing state_class to xiaomi_aqara sensors (#73167)

Add missing state_class
This commit is contained in:
Maciej Bieniek 2022-06-07 19:57:29 +02:00 committed by GitHub
parent 981c34f88d
commit f10cae1052
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ from homeassistant.components.sensor import (
SensorDeviceClass, SensorDeviceClass,
SensorEntity, SensorEntity,
SensorEntityDescription, SensorEntityDescription,
SensorStateClass,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
@ -30,36 +31,43 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
key="temperature", key="temperature",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
), ),
"humidity": SensorEntityDescription( "humidity": SensorEntityDescription(
key="humidity", key="humidity",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
), ),
"illumination": SensorEntityDescription( "illumination": SensorEntityDescription(
key="illumination", key="illumination",
native_unit_of_measurement="lm", native_unit_of_measurement="lm",
device_class=SensorDeviceClass.ILLUMINANCE, device_class=SensorDeviceClass.ILLUMINANCE,
state_class=SensorStateClass.MEASUREMENT,
), ),
"lux": SensorEntityDescription( "lux": SensorEntityDescription(
key="lux", key="lux",
native_unit_of_measurement=LIGHT_LUX, native_unit_of_measurement=LIGHT_LUX,
device_class=SensorDeviceClass.ILLUMINANCE, device_class=SensorDeviceClass.ILLUMINANCE,
state_class=SensorStateClass.MEASUREMENT,
), ),
"pressure": SensorEntityDescription( "pressure": SensorEntityDescription(
key="pressure", key="pressure",
native_unit_of_measurement=PRESSURE_HPA, native_unit_of_measurement=PRESSURE_HPA,
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
), ),
"bed_activity": SensorEntityDescription( "bed_activity": SensorEntityDescription(
key="bed_activity", key="bed_activity",
native_unit_of_measurement="μm", native_unit_of_measurement="μm",
device_class=None, device_class=None,
state_class=SensorStateClass.MEASUREMENT,
), ),
"load_power": SensorEntityDescription( "load_power": SensorEntityDescription(
key="load_power", key="load_power",
native_unit_of_measurement=POWER_WATT, native_unit_of_measurement=POWER_WATT,
device_class=SensorDeviceClass.POWER, device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
), ),
"final_tilt_angle": SensorEntityDescription( "final_tilt_angle": SensorEntityDescription(
key="final_tilt_angle", key="final_tilt_angle",
@ -69,6 +77,7 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
), ),
"Battery": SensorEntityDescription( "Battery": SensorEntityDescription(
key="Battery", key="Battery",
state_class=SensorStateClass.MEASUREMENT,
), ),
} }