Fix AirGradient VOC and NOx learning offset units (#180305)

This commit is contained in:
Samuel Siburian
2026-10-05 16:01:36 +00:00
committed by Franck Nijhof
parent a75d3ee61e
commit ff68fea56c
2 changed files with 14 additions and 14 deletions
@@ -236,7 +236,7 @@ CONFIG_SENSOR_TYPES: tuple[AirGradientConfigSensorEntityDescription, ...] = (
key="nox_learning_offset",
translation_key="nox_learning_offset",
device_class=SensorDeviceClass.DURATION,
native_unit_of_measurement=UnitOfTime.DAYS,
native_unit_of_measurement=UnitOfTime.HOURS,
entity_category=EntityCategory.DIAGNOSTIC,
config_key="nox_learning_offset",
value_fn=lambda config: config.nox_learning_offset,
@@ -245,7 +245,7 @@ CONFIG_SENSOR_TYPES: tuple[AirGradientConfigSensorEntityDescription, ...] = (
key="tvoc_learning_offset",
translation_key="tvoc_learning_offset",
device_class=SensorDeviceClass.DURATION,
native_unit_of_measurement=UnitOfTime.DAYS,
native_unit_of_measurement=UnitOfTime.HOURS,
entity_category=EntityCategory.DIAGNOSTIC,
config_key="tvoc_learning_offset",
value_fn=lambda config: config.tvoc_learning_offset,
@@ -538,7 +538,7 @@
'supported_features': 0,
'translation_key': 'nox_learning_offset',
'unique_id': '84fce612f5b8-nox_learning_offset',
'unit_of_measurement': <UnitOfTime.DAYS: 'd'>,
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
})
# ---
# name: test_all_entities[indoor][sensor.airgradient_nox_index_learning_offset-state]
@@ -546,7 +546,7 @@
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Airgradient NOx index learning offset',
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.DAYS: 'd'>,
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
}),
'context': <ANY>,
'entity_id': 'sensor.airgradient_nox_index_learning_offset',
@@ -1141,7 +1141,7 @@
'supported_features': 0,
'translation_key': 'tvoc_learning_offset',
'unique_id': '84fce612f5b8-tvoc_learning_offset',
'unit_of_measurement': <UnitOfTime.DAYS: 'd'>,
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
})
# ---
# name: test_all_entities[indoor][sensor.airgradient_voc_index_learning_offset-state]
@@ -1149,7 +1149,7 @@
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Airgradient VOC index learning offset',
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.DAYS: 'd'>,
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
}),
'context': <ANY>,
'entity_id': 'sensor.airgradient_voc_index_learning_offset',
@@ -1304,7 +1304,7 @@
'supported_features': 0,
'translation_key': 'nox_learning_offset',
'unique_id': '84fce612f5b8-nox_learning_offset',
'unit_of_measurement': <UnitOfTime.DAYS: 'd'>,
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
})
# ---
# name: test_all_entities[outdoor][sensor.airgradient_nox_index_learning_offset-state]
@@ -1312,7 +1312,7 @@
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Airgradient NOx index learning offset',
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.DAYS: 'd'>,
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
}),
'context': <ANY>,
'entity_id': 'sensor.airgradient_nox_index_learning_offset',
@@ -1575,7 +1575,7 @@
'supported_features': 0,
'translation_key': 'tvoc_learning_offset',
'unique_id': '84fce612f5b8-tvoc_learning_offset',
'unit_of_measurement': <UnitOfTime.DAYS: 'd'>,
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
})
# ---
# name: test_all_entities[outdoor][sensor.airgradient_voc_index_learning_offset-state]
@@ -1583,7 +1583,7 @@
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Airgradient VOC index learning offset',
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.DAYS: 'd'>,
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
}),
'context': <ANY>,
'entity_id': 'sensor.airgradient_voc_index_learning_offset',
@@ -2139,7 +2139,7 @@
'supported_features': 0,
'translation_key': 'nox_learning_offset',
'unique_id': '84fce612f5b8-nox_learning_offset',
'unit_of_measurement': <UnitOfTime.DAYS: 'd'>,
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
})
# ---
# name: test_v1_entities[sensor.airgradient_nox_index_learning_offset-state]
@@ -2147,7 +2147,7 @@
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Airgradient NOx index learning offset',
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.DAYS: 'd'>,
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
}),
'context': <ANY>,
'entity_id': 'sensor.airgradient_nox_index_learning_offset',
@@ -2957,7 +2957,7 @@
'supported_features': 0,
'translation_key': 'tvoc_learning_offset',
'unique_id': '84fce612f5b8-tvoc_learning_offset',
'unit_of_measurement': <UnitOfTime.DAYS: 'd'>,
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
})
# ---
# name: test_v1_entities[sensor.airgradient_voc_index_learning_offset-state]
@@ -2965,7 +2965,7 @@
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Airgradient VOC index learning offset',
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.DAYS: 'd'>,
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
}),
'context': <ANY>,
'entity_id': 'sensor.airgradient_voc_index_learning_offset',