mirror of
https://github.com/home-assistant/core.git
synced 2026-02-15 07:36:16 +00:00
Add more pollutants to Google Air Quality (#160738)
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
{
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"ammonia": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"benzene": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"nitrogen_dioxide": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"nitrogen_monoxide": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"non_methane_hydrocarbons": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"ozone": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
|
||||
@@ -99,6 +99,14 @@ AIR_QUALITY_SENSOR_TYPES: tuple[AirQualitySensorEntityDescription, ...] = (
|
||||
"local_aqi": data.indexes[1].display_name
|
||||
},
|
||||
),
|
||||
AirQualitySensorEntityDescription(
|
||||
key="c6h6",
|
||||
translation_key="benzene",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement_fn=lambda x: x.pollutants.c6h6.concentration.units,
|
||||
value_fn=lambda x: x.pollutants.c6h6.concentration.value,
|
||||
exists_fn=lambda x: "c6h6" in {p.code for p in x.pollutants},
|
||||
),
|
||||
AirQualitySensorEntityDescription(
|
||||
key="co",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
@@ -106,6 +114,30 @@ AIR_QUALITY_SENSOR_TYPES: tuple[AirQualitySensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement_fn=lambda x: x.pollutants.co.concentration.units,
|
||||
value_fn=lambda x: x.pollutants.co.concentration.value,
|
||||
),
|
||||
AirQualitySensorEntityDescription(
|
||||
key="nh3",
|
||||
translation_key="ammonia",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement_fn=lambda x: x.pollutants.nh3.concentration.units,
|
||||
value_fn=lambda x: x.pollutants.nh3.concentration.value,
|
||||
exists_fn=lambda x: "nh3" in {p.code for p in x.pollutants},
|
||||
),
|
||||
AirQualitySensorEntityDescription(
|
||||
key="nmhc",
|
||||
translation_key="non_methane_hydrocarbons",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement_fn=lambda x: x.pollutants.nmhc.concentration.units,
|
||||
value_fn=lambda x: x.pollutants.nmhc.concentration.value,
|
||||
exists_fn=lambda x: "nmhc" in {p.code for p in x.pollutants},
|
||||
),
|
||||
AirQualitySensorEntityDescription(
|
||||
key="no",
|
||||
translation_key="nitrogen_monoxide",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement_fn=lambda x: x.pollutants.no.concentration.units,
|
||||
value_fn=lambda x: x.pollutants.no.concentration.value,
|
||||
exists_fn=lambda x: "no" in {p.code for p in x.pollutants},
|
||||
),
|
||||
AirQualitySensorEntityDescription(
|
||||
key="no2",
|
||||
translation_key="nitrogen_dioxide",
|
||||
|
||||
@@ -76,6 +76,12 @@
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"ammonia": {
|
||||
"name": "Ammonia"
|
||||
},
|
||||
"benzene": {
|
||||
"name": "Benzene"
|
||||
},
|
||||
"local_aqi": {
|
||||
"name": "{local_aqi} AQI"
|
||||
},
|
||||
@@ -189,6 +195,9 @@
|
||||
"name": "{local_aqi} dominant pollutant",
|
||||
"state": {
|
||||
"co": "[%key:component::sensor::entity_component::carbon_monoxide::name%]",
|
||||
"nh3": "[%key:component::google_air_quality::entity::sensor::ammonia::name%]",
|
||||
"nmhc": "[%key:component::google_air_quality::entity::sensor::non_methane_hydrocarbons::name%]",
|
||||
"no": "[%key:component::sensor::entity_component::nitrogen_monoxide::name%]",
|
||||
"no2": "[%key:component::sensor::entity_component::nitrogen_dioxide::name%]",
|
||||
"o3": "[%key:component::sensor::entity_component::ozone::name%]",
|
||||
"pm10": "[%key:component::sensor::entity_component::pm10::name%]",
|
||||
@@ -199,6 +208,12 @@
|
||||
"nitrogen_dioxide": {
|
||||
"name": "[%key:component::sensor::entity_component::nitrogen_dioxide::name%]"
|
||||
},
|
||||
"nitrogen_monoxide": {
|
||||
"name": "[%key:component::sensor::entity_component::nitrogen_monoxide::name%]"
|
||||
},
|
||||
"non_methane_hydrocarbons": {
|
||||
"name": "Non-methane hydrocarbons"
|
||||
},
|
||||
"ozone": {
|
||||
"name": "[%key:component::sensor::entity_component::ozone::name%]"
|
||||
},
|
||||
|
||||
@@ -81,6 +81,42 @@
|
||||
"value": 1.2,
|
||||
"units": "PARTS_PER_BILLION"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "nh3",
|
||||
"displayName": "NH3",
|
||||
"fullName": "Ammonia",
|
||||
"concentration": {
|
||||
"value": 81.41,
|
||||
"units": "PARTS_PER_BILLION"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "no",
|
||||
"displayName": "NO",
|
||||
"fullName": "Nitrogen monoxide",
|
||||
"concentration": {
|
||||
"value": 0.62,
|
||||
"units": "PARTS_PER_BILLION"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "nmhc",
|
||||
"displayName": "NMHC",
|
||||
"fullName": "Non-methane hydrocarbons",
|
||||
"concentration": {
|
||||
"value": 52.66,
|
||||
"units": "PARTS_PER_BILLION"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "c6h6",
|
||||
"displayName": "C6H6",
|
||||
"fullName": "Benzene",
|
||||
"concentration": {
|
||||
"value": 0.24,
|
||||
"units": "MICROGRAMS_PER_CUBIC_METER"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,110 @@
|
||||
# serializer version: 1
|
||||
# name: test_sensor_snapshot[sensor.home_ammonia-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.home_ammonia',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Ammonia',
|
||||
'platform': 'google_air_quality',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'ammonia',
|
||||
'unique_id': 'nh3_10.1_20.1',
|
||||
'unit_of_measurement': 'ppb',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_snapshot[sensor.home_ammonia-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'attribution': 'Data provided by Google Air Quality',
|
||||
'friendly_name': 'Home Ammonia',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 'ppb',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.home_ammonia',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '81.41',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_snapshot[sensor.home_benzene-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.home_benzene',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Benzene',
|
||||
'platform': 'google_air_quality',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'benzene',
|
||||
'unique_id': 'c6h6_10.1_20.1',
|
||||
'unit_of_measurement': 'μg/m³',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_snapshot[sensor.home_benzene-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'attribution': 'Data provided by Google Air Quality',
|
||||
'friendly_name': 'Home Benzene',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 'μg/m³',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.home_benzene',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '0.24',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_snapshot[sensor.home_carbon_monoxide-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
@@ -234,6 +340,112 @@
|
||||
'state': '14.18',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_snapshot[sensor.home_nitrogen_monoxide-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.home_nitrogen_monoxide',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Nitrogen monoxide',
|
||||
'platform': 'google_air_quality',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'nitrogen_monoxide',
|
||||
'unique_id': 'no_10.1_20.1',
|
||||
'unit_of_measurement': 'ppb',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_snapshot[sensor.home_nitrogen_monoxide-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'attribution': 'Data provided by Google Air Quality',
|
||||
'friendly_name': 'Home Nitrogen monoxide',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 'ppb',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.home_nitrogen_monoxide',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '0.62',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_snapshot[sensor.home_non_methane_hydrocarbons-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.home_non_methane_hydrocarbons',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Non-methane hydrocarbons',
|
||||
'platform': 'google_air_quality',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'non_methane_hydrocarbons',
|
||||
'unique_id': 'nmhc_10.1_20.1',
|
||||
'unit_of_measurement': 'ppb',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_snapshot[sensor.home_non_methane_hydrocarbons-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'attribution': 'Data provided by Google Air Quality',
|
||||
'friendly_name': 'Home Non-methane hydrocarbons',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 'ppb',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.home_non_methane_hydrocarbons',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '52.66',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_snapshot[sensor.home_ozone-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
|
||||
Reference in New Issue
Block a user