Use the default entity names in Airly (#90693)

This commit is contained in:
Maciej Bieniek 2023-04-03 10:50:24 +02:00 committed by GitHub
parent 3c536e31eb
commit cacd6708f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 20 deletions

View file

@ -30,37 +30,37 @@
"entity": {
"sensor": {
"caqi": {
"name": "CAQI"
"name": "Common air quality index"
},
"pm1": {
"name": "PM1.0"
"name": "[%key:component::sensor::entity_component::pm1::name%]"
},
"pm25": {
"name": "PM2.5"
"name": "[%key:component::sensor::entity_component::pm25::name%]"
},
"pm10": {
"name": "PM10"
"name": "[%key:component::sensor::entity_component::pm10::name%]"
},
"humidity": {
"name": "Humidity"
"name": "[%key:component::sensor::entity_component::humidity::name%]"
},
"pressure": {
"name": "Pressure"
"name": "[%key:component::sensor::entity_component::pressure::name%]"
},
"temperature": {
"name": "Temperature"
"name": "[%key:component::sensor::entity_component::temperature::name%]"
},
"co": {
"name": "Carbon monoxide"
"name": "[%key:component::sensor::entity_component::carbon_monoxide::name%]"
},
"no2": {
"name": "Nitrogen dioxide"
"name": "[%key:component::sensor::entity_component::nitrogen_dioxide::name%]"
},
"so2": {
"name": "Sulphur dioxide"
"name": "[%key:component::sensor::entity_component::sulphur_dioxide::name%]"
},
"o3": {
"name": "Ozone"
"name": "[%key:component::sensor::entity_component::ozone::name%]"
}
}
}

View file

@ -25,7 +25,7 @@ async def test_async_setup_entry(
"""Test a successful setup entry."""
await init_integration(hass, aioclient_mock)
state = hass.states.get("sensor.home_pm2_5")
state = hass.states.get("sensor.home_particulate_matter_2_5_mm")
assert state is not None
assert state.state != STATE_UNAVAILABLE
assert state.state == "4.37"

View file

@ -38,14 +38,14 @@ async def test_sensor(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker)
await init_integration(hass, aioclient_mock)
registry = er.async_get(hass)
state = hass.states.get("sensor.home_caqi")
state = hass.states.get("sensor.home_common_air_quality_index")
assert state
assert state.state == "7.29"
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "CAQI"
assert state.attributes.get(ATTR_ICON) == "mdi:air-filter"
entry = registry.async_get("sensor.home_caqi")
entry = registry.async_get("sensor.home_common_air_quality_index")
assert entry
assert entry.unique_id == "123-456-caqi"
assert entry.options["sensor"] == {"suggested_display_precision": 0}
@ -63,7 +63,7 @@ async def test_sensor(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker)
assert entry.unique_id == "123-456-humidity"
assert entry.options["sensor"] == {"suggested_display_precision": 1}
state = hass.states.get("sensor.home_pm1_0")
state = hass.states.get("sensor.home_particulate_matter_1_mm")
assert state
assert state.state == "2.83"
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
@ -74,12 +74,12 @@ async def test_sensor(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker)
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.PM1
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
entry = registry.async_get("sensor.home_pm1_0")
entry = registry.async_get("sensor.home_particulate_matter_1_mm")
assert entry
assert entry.unique_id == "123-456-pm1"
assert entry.options["sensor"] == {"suggested_display_precision": 0}
state = hass.states.get("sensor.home_pm2_5")
state = hass.states.get("sensor.home_particulate_matter_2_5_mm")
assert state
assert state.state == "4.37"
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
@ -90,12 +90,12 @@ async def test_sensor(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker)
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.PM25
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
entry = registry.async_get("sensor.home_pm2_5")
entry = registry.async_get("sensor.home_particulate_matter_2_5_mm")
assert entry
assert entry.unique_id == "123-456-pm25"
assert entry.options["sensor"] == {"suggested_display_precision": 0}
state = hass.states.get("sensor.home_pm10")
state = hass.states.get("sensor.home_particulate_matter_10_mm")
assert state
assert state.state == "6.06"
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
@ -106,7 +106,7 @@ async def test_sensor(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker)
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.PM10
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
entry = registry.async_get("sensor.home_pm10")
entry = registry.async_get("sensor.home_particulate_matter_10_mm")
assert entry
assert entry.unique_id == "123-456-pm10"
assert entry.options["sensor"] == {"suggested_display_precision": 0}