diff --git a/homeassistant/components/homekit_controller/sensor.py b/homeassistant/components/homekit_controller/sensor.py index de59a70ddaf..33320a7660e 100644 --- a/homeassistant/components/homekit_controller/sensor.py +++ b/homeassistant/components/homekit_controller/sensor.py @@ -31,9 +31,9 @@ from homeassistant.const import ( POWER_WATT, PRESSURE_HPA, SIGNAL_STRENGTH_DECIBELS_MILLIWATT, - SOUND_PRESSURE_DB, TEMP_CELSIUS, Platform, + UnitOfSoundPressure, ) from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity import EntityCategory @@ -330,7 +330,8 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = { key=CharacteristicsTypes.VENDOR_NETATMO_NOISE, name="Noise", state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=SOUND_PRESSURE_DB, + native_unit_of_measurement=UnitOfSoundPressure.DECIBEL, + device_class=SensorDeviceClass.SOUND_PRESSURE, ), } diff --git a/homeassistant/components/mysensors/sensor.py b/homeassistant/components/mysensors/sensor.py index 3c190422bfb..0339c75d97c 100644 --- a/homeassistant/components/mysensors/sensor.py +++ b/homeassistant/components/mysensors/sensor.py @@ -25,12 +25,12 @@ from homeassistant.const import ( MASS_KILOGRAMS, PERCENTAGE, POWER_WATT, - SOUND_PRESSURE_DB, TEMP_CELSIUS, TEMP_FAHRENHEIT, VOLUME_CUBIC_METERS, Platform, UnitOfApparentPower, + UnitOfSoundPressure, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -134,8 +134,8 @@ SENSORS: dict[str, SensorEntityDescription] = { ), "V_LEVEL_S_SOUND": SensorEntityDescription( key="V_LEVEL_S_SOUND", - native_unit_of_measurement=SOUND_PRESSURE_DB, - icon="mdi:volume-high", + native_unit_of_measurement=UnitOfSoundPressure.DECIBEL, + device_class=SensorDeviceClass.SOUND_PRESSURE, ), "V_LEVEL_S_VIBRATION": SensorEntityDescription( key="V_LEVEL_S_VIBRATION", diff --git a/homeassistant/components/netatmo/sensor.py b/homeassistant/components/netatmo/sensor.py index 4652f8a64a8..765f7ab309c 100644 --- a/homeassistant/components/netatmo/sensor.py +++ b/homeassistant/components/netatmo/sensor.py @@ -20,10 +20,10 @@ from homeassistant.const import ( CONCENTRATION_PARTS_PER_MILLION, DEGREE, PERCENTAGE, - SOUND_PRESSURE_DB, UnitOfPower, UnitOfPrecipitationDepth, UnitOfPressure, + UnitOfSoundPressure, UnitOfSpeed, UnitOfTemperature, ) @@ -129,8 +129,8 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = ( name="Noise", netatmo_name="noise", entity_registry_enabled_default=True, - native_unit_of_measurement=SOUND_PRESSURE_DB, - icon="mdi:volume-high", + native_unit_of_measurement=UnitOfSoundPressure.DECIBEL, + device_class=SensorDeviceClass.SOUND_PRESSURE, state_class=SensorStateClass.MEASUREMENT, ), NetatmoSensorEntityDescription( diff --git a/tests/components/mysensors/test_sensor.py b/tests/components/mysensors/test_sensor.py index 3a1b7b56872..e9c8aad148f 100644 --- a/tests/components/mysensors/test_sensor.py +++ b/tests/components/mysensors/test_sensor.py @@ -105,7 +105,7 @@ async def test_sound_sensor( assert state assert state.state == "10" - assert state.attributes[ATTR_ICON] == "mdi:volume-high" + assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.SOUND_PRESSURE assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == "dB"