mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Use SoundPressure unit and device class in awair (#83582)
This commit is contained in:
parent
248d5ff541
commit
ec0af2f25d
@ -19,8 +19,8 @@ from homeassistant.const import (
|
|||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
SOUND_PRESSURE_WEIGHTED_DBA,
|
UnitOfSoundPressure,
|
||||||
TEMP_CELSIUS,
|
UnitOfTemperature,
|
||||||
)
|
)
|
||||||
|
|
||||||
API_CO2 = "carbon_dioxide"
|
API_CO2 = "carbon_dioxide"
|
||||||
@ -87,8 +87,8 @@ SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
|
|||||||
),
|
),
|
||||||
AwairSensorEntityDescription(
|
AwairSensorEntityDescription(
|
||||||
key=API_SPL_A,
|
key=API_SPL_A,
|
||||||
icon="mdi:ear-hearing",
|
device_class=SensorDeviceClass.SOUND_PRESSURE,
|
||||||
native_unit_of_measurement=SOUND_PRESSURE_WEIGHTED_DBA,
|
native_unit_of_measurement=UnitOfSoundPressure.WEIGHTED_DECIBEL_A,
|
||||||
name="Sound level",
|
name="Sound level",
|
||||||
unique_id_tag="sound_level",
|
unique_id_tag="sound_level",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
@ -104,7 +104,7 @@ SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
|
|||||||
AwairSensorEntityDescription(
|
AwairSensorEntityDescription(
|
||||||
key=API_TEMP,
|
key=API_TEMP,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
unique_id_tag="TEMP", # matches legacy format
|
unique_id_tag="TEMP", # matches legacy format
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
@ -287,7 +287,7 @@ async def test_awair_omni_sensors(hass: HomeAssistant, user, cloud_devices, omni
|
|||||||
"sensor.living_room_sound_level",
|
"sensor.living_room_sound_level",
|
||||||
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SPL_A].unique_id_tag}",
|
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SPL_A].unique_id_tag}",
|
||||||
"47.0",
|
"47.0",
|
||||||
{ATTR_UNIT_OF_MEASUREMENT: "dBa"},
|
{ATTR_UNIT_OF_MEASUREMENT: "dBA"},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_expected_properties(
|
assert_expected_properties(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user