Fix unit of measurement for airgradient sensor (#118981)

pull/119052/head
Joost Lekkerkerker 2024-06-07 09:17:36 +02:00 committed by GitHub
parent aa0a90cd98
commit 6027af3d36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 8 deletions

View File

@ -103,6 +103,7 @@ SENSOR_TYPES: tuple[AirGradientSensorEntityDescription, ...] = (
AirGradientSensorEntityDescription(
key="pm003",
translation_key="pm003_count",
native_unit_of_measurement="particles/dL",
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda status: status.pm003_count,
),

View File

@ -48,7 +48,7 @@
"name": "Nitrogen index"
},
"pm003_count": {
"name": "PM0.3 count"
"name": "PM0.3"
},
"raw_total_volatile_organic_component": {
"name": "Raw total VOC"

View File

@ -150,7 +150,7 @@
'state': '1',
})
# ---
# name: test_all_entities[sensor.airgradient_pm0_3_count-entry]
# name: test_all_entities[sensor.airgradient_pm0_3-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
@ -164,7 +164,7 @@
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.airgradient_pm0_3_count',
'entity_id': 'sensor.airgradient_pm0_3',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
@ -176,23 +176,24 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'PM0.3 count',
'original_name': 'PM0.3',
'platform': 'airgradient',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'pm003_count',
'unique_id': '84fce612f5b8-pm003',
'unit_of_measurement': None,
'unit_of_measurement': 'particles/dL',
})
# ---
# name: test_all_entities[sensor.airgradient_pm0_3_count-state]
# name: test_all_entities[sensor.airgradient_pm0_3-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Airgradient PM0.3 count',
'friendly_name': 'Airgradient PM0.3',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': 'particles/dL',
}),
'context': <ANY>,
'entity_id': 'sensor.airgradient_pm0_3_count',
'entity_id': 'sensor.airgradient_pm0_3',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,