Use SoundPressure unit and device class in awair (#83582)

pull/83684/head
epenet 2022-12-08 20:56:02 +01:00 committed by GitHub
parent 248d5ff541
commit ec0af2f25d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -19,8 +19,8 @@ from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION,
LIGHT_LUX,
PERCENTAGE,
SOUND_PRESSURE_WEIGHTED_DBA,
TEMP_CELSIUS,
UnitOfSoundPressure,
UnitOfTemperature,
)
API_CO2 = "carbon_dioxide"
@ -87,8 +87,8 @@ SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
),
AwairSensorEntityDescription(
key=API_SPL_A,
icon="mdi:ear-hearing",
native_unit_of_measurement=SOUND_PRESSURE_WEIGHTED_DBA,
device_class=SensorDeviceClass.SOUND_PRESSURE,
native_unit_of_measurement=UnitOfSoundPressure.WEIGHTED_DECIBEL_A,
name="Sound level",
unique_id_tag="sound_level",
state_class=SensorStateClass.MEASUREMENT,
@ -104,7 +104,7 @@ SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
AwairSensorEntityDescription(
key=API_TEMP,
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=TEMP_CELSIUS,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
name="Temperature",
unique_id_tag="TEMP", # matches legacy format
state_class=SensorStateClass.MEASUREMENT,

View File

@ -287,7 +287,7 @@ async def test_awair_omni_sensors(hass: HomeAssistant, user, cloud_devices, omni
"sensor.living_room_sound_level",
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SPL_A].unique_id_tag}",
"47.0",
{ATTR_UNIT_OF_MEASUREMENT: "dBa"},
{ATTR_UNIT_OF_MEASUREMENT: "dBA"},
)
assert_expected_properties(