Update awair SensorDeviceClass to specify icon (#75385)

pull/75489/head
Zach Berger 2022-07-20 03:08:34 -07:00 committed by GitHub
parent 39dc9aa179
commit 712492b066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 19 deletions

View File

@ -86,7 +86,7 @@ SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
),
AwairSensorEntityDescription(
key=API_VOC,
icon="mdi:cloud",
icon="mdi:molecule",
native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION,
name="Volatile organic compounds",
unique_id_tag="VOC", # matches legacy format
@ -101,7 +101,6 @@ SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
AwairSensorEntityDescription(
key=API_CO2,
device_class=SensorDeviceClass.CO2,
icon="mdi:cloud",
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
name="Carbon dioxide",
unique_id_tag="CO2", # matches legacy format
@ -111,14 +110,14 @@ SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
SENSOR_TYPES_DUST: tuple[AwairSensorEntityDescription, ...] = (
AwairSensorEntityDescription(
key=API_PM25,
icon="mdi:blur",
device_class=SensorDeviceClass.PM25,
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
name="PM2.5",
unique_id_tag="PM25", # matches legacy format
),
AwairSensorEntityDescription(
key=API_PM10,
icon="mdi:blur",
device_class=SensorDeviceClass.PM10,
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
name="PM10",
unique_id_tag="PM10", # matches legacy format

View File

@ -17,7 +17,6 @@ from homeassistant.components.awair.const import (
SENSOR_TYPES_DUST,
)
from homeassistant.const import (
ATTR_ICON,
ATTR_UNIT_OF_MEASUREMENT,
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
CONCENTRATION_PARTS_PER_BILLION,
@ -88,7 +87,7 @@ async def test_awair_gen1_sensors(hass):
"sensor.living_room_awair_score",
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SCORE].unique_id_tag}",
"88",
{ATTR_ICON: "mdi:blur"},
{},
)
assert_expected_properties(
@ -116,7 +115,6 @@ async def test_awair_gen1_sensors(hass):
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_CO2].unique_id_tag}",
"654.0",
{
ATTR_ICON: "mdi:cloud",
ATTR_UNIT_OF_MEASUREMENT: CONCENTRATION_PARTS_PER_MILLION,
"awair_index": 0.0,
},
@ -129,7 +127,6 @@ async def test_awair_gen1_sensors(hass):
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_VOC].unique_id_tag}",
"366",
{
ATTR_ICON: "mdi:cloud",
ATTR_UNIT_OF_MEASUREMENT: CONCENTRATION_PARTS_PER_BILLION,
"awair_index": 1.0,
},
@ -143,7 +140,6 @@ async def test_awair_gen1_sensors(hass):
f"{AWAIR_UUID}_DUST",
"14.3",
{
ATTR_ICON: "mdi:blur",
ATTR_UNIT_OF_MEASUREMENT: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
"awair_index": 1.0,
},
@ -156,7 +152,6 @@ async def test_awair_gen1_sensors(hass):
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_PM10].unique_id_tag}",
"14.3",
{
ATTR_ICON: "mdi:blur",
ATTR_UNIT_OF_MEASUREMENT: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
"awair_index": 1.0,
},
@ -184,7 +179,7 @@ async def test_awair_gen2_sensors(hass):
"sensor.living_room_awair_score",
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SCORE].unique_id_tag}",
"97",
{ATTR_ICON: "mdi:blur"},
{},
)
assert_expected_properties(
@ -194,7 +189,6 @@ async def test_awair_gen2_sensors(hass):
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_PM25].unique_id_tag}",
"2.0",
{
ATTR_ICON: "mdi:blur",
ATTR_UNIT_OF_MEASUREMENT: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
"awair_index": 0.0,
},
@ -218,7 +212,7 @@ async def test_awair_mint_sensors(hass):
"sensor.living_room_awair_score",
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SCORE].unique_id_tag}",
"98",
{ATTR_ICON: "mdi:blur"},
{},
)
assert_expected_properties(
@ -228,7 +222,6 @@ async def test_awair_mint_sensors(hass):
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_PM25].unique_id_tag}",
"1.0",
{
ATTR_ICON: "mdi:blur",
ATTR_UNIT_OF_MEASUREMENT: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
"awair_index": 0.0,
},
@ -260,7 +253,7 @@ async def test_awair_glow_sensors(hass):
"sensor.living_room_awair_score",
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SCORE].unique_id_tag}",
"93",
{ATTR_ICON: "mdi:blur"},
{},
)
# The glow does not have a particle sensor
@ -280,7 +273,7 @@ async def test_awair_omni_sensors(hass):
"sensor.living_room_awair_score",
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SCORE].unique_id_tag}",
"99",
{ATTR_ICON: "mdi:blur"},
{},
)
assert_expected_properties(
@ -289,7 +282,7 @@ async def test_awair_omni_sensors(hass):
"sensor.living_room_sound_level",
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SPL_A].unique_id_tag}",
"47.0",
{ATTR_ICON: "mdi:ear-hearing", ATTR_UNIT_OF_MEASUREMENT: "dBa"},
{ATTR_UNIT_OF_MEASUREMENT: "dBa"},
)
assert_expected_properties(
@ -333,7 +326,7 @@ async def test_awair_unavailable(hass):
"sensor.living_room_awair_score",
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SCORE].unique_id_tag}",
"88",
{ATTR_ICON: "mdi:blur"},
{},
)
with patch("python_awair.AwairClient.query", side_effect=OFFLINE_FIXTURE):
@ -344,5 +337,5 @@ async def test_awair_unavailable(hass):
"sensor.living_room_awair_score",
f"{AWAIR_UUID}_{SENSOR_TYPES_MAP[API_SCORE].unique_id_tag}",
STATE_UNAVAILABLE,
{ATTR_ICON: "mdi:blur"},
{},
)