From 8d24d775f1d116bbe44c70b44e62b35195519b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A5le=20Stor=C3=B8=20Hauknes?= Date: Wed, 11 Jun 2025 20:04:03 +0200 Subject: [PATCH] Set suggested precision for Airthings sensors (#145966) --- homeassistant/components/airthings/sensor.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/homeassistant/components/airthings/sensor.py b/homeassistant/components/airthings/sensor.py index a3e4cebe771..ff30fb2f2ae 100644 --- a/homeassistant/components/airthings/sensor.py +++ b/homeassistant/components/airthings/sensor.py @@ -37,30 +37,35 @@ SENSORS: dict[str, SensorEntityDescription] = { key="radonShortTermAvg", native_unit_of_measurement="Bq/m³", translation_key="radon", + suggested_display_precision=0, ), "temp": SensorEntityDescription( key="temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=1, ), "humidity": SensorEntityDescription( key="humidity", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "pressure": SensorEntityDescription( key="pressure", device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE, native_unit_of_measurement=UnitOfPressure.MBAR, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=1, ), "sla": SensorEntityDescription( key="sla", device_class=SensorDeviceClass.SOUND_PRESSURE, native_unit_of_measurement=UnitOfSoundPressure.WEIGHTED_DECIBEL_A, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "battery": SensorEntityDescription( key="battery", @@ -68,40 +73,47 @@ SENSORS: dict[str, SensorEntityDescription] = { native_unit_of_measurement=PERCENTAGE, entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "co2": SensorEntityDescription( key="co2", device_class=SensorDeviceClass.CO2, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "voc": SensorEntityDescription( key="voc", device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS_PARTS, native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "light": SensorEntityDescription( key="light", native_unit_of_measurement=PERCENTAGE, translation_key="light", state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "lux": SensorEntityDescription( key="lux", device_class=SensorDeviceClass.ILLUMINANCE, native_unit_of_measurement=LIGHT_LUX, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "virusRisk": SensorEntityDescription( key="virusRisk", translation_key="virus_risk", state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "mold": SensorEntityDescription( key="mold", translation_key="mold", state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "rssi": SensorEntityDescription( key="rssi", @@ -110,18 +122,21 @@ SENSORS: dict[str, SensorEntityDescription] = { entity_registry_enabled_default=False, entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "pm1": SensorEntityDescription( key="pm1", native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, device_class=SensorDeviceClass.PM1, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), "pm25": SensorEntityDescription( key="pm25", native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, device_class=SensorDeviceClass.PM25, state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=0, ), }