Use the default entity names in GIOS (#90700)
This commit is contained in:
parent
34041c7564
commit
eb748416ed
3 changed files with 37 additions and 37 deletions
|
@ -26,7 +26,7 @@
|
|||
"entity": {
|
||||
"sensor": {
|
||||
"aqi": {
|
||||
"name": "AQI",
|
||||
"name": "[%key:component::sensor::entity_component::aqi::name%]",
|
||||
"state": {
|
||||
"very_bad": "Very bad",
|
||||
"bad": "Bad",
|
||||
|
@ -40,10 +40,10 @@
|
|||
"name": "Benzene"
|
||||
},
|
||||
"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%]"
|
||||
},
|
||||
"no2_index": {
|
||||
"name": "Nitrogen dioxide index",
|
||||
|
@ -57,7 +57,7 @@
|
|||
}
|
||||
},
|
||||
"o3": {
|
||||
"name": "Ozone"
|
||||
"name": "[%key:component::sensor::entity_component::ozone::name%]"
|
||||
},
|
||||
"o3_index": {
|
||||
"name": "Ozone index",
|
||||
|
@ -71,10 +71,10 @@
|
|||
}
|
||||
},
|
||||
"pm10": {
|
||||
"name": "PM10"
|
||||
"name": "[%key:component::sensor::entity_component::pm10::name%]"
|
||||
},
|
||||
"pm10_index": {
|
||||
"name": "PM10 index",
|
||||
"name": "Particulate matter 10 μm index",
|
||||
"state": {
|
||||
"very_bad": "[%key:component::gios::entity::sensor::aqi::state::very_bad%]",
|
||||
"bad": "[%key:component::gios::entity::sensor::aqi::state::bad%]",
|
||||
|
@ -85,10 +85,10 @@
|
|||
}
|
||||
},
|
||||
"pm25": {
|
||||
"name": "PM2.5"
|
||||
"name": "[%key:component::sensor::entity_component::pm25::name%]"
|
||||
},
|
||||
"pm25_index": {
|
||||
"name": "PM2.5 index",
|
||||
"name": "Particulate matter 2.5 μm index",
|
||||
"state": {
|
||||
"very_bad": "[%key:component::gios::entity::sensor::aqi::state::very_bad%]",
|
||||
"bad": "[%key:component::gios::entity::sensor::aqi::state::bad%]",
|
||||
|
@ -99,7 +99,7 @@
|
|||
}
|
||||
},
|
||||
"so2": {
|
||||
"name": "Sulphur dioxide"
|
||||
"name": "[%key:component::sensor::entity_component::sulphur_dioxide::name%]"
|
||||
},
|
||||
"so2_index": {
|
||||
"name": "Sulphur dioxide index",
|
||||
|
|
|
@ -18,7 +18,7 @@ async def test_async_setup_entry(hass: HomeAssistant) -> None:
|
|||
"""Test a successful setup entry."""
|
||||
await init_integration(hass)
|
||||
|
||||
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"
|
||||
|
|
|
@ -131,7 +131,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
assert entry
|
||||
assert entry.unique_id == "123-o3-index"
|
||||
|
||||
state = hass.states.get("sensor.home_pm10")
|
||||
state = hass.states.get("sensor.home_particulate_matter_10_mm")
|
||||
assert state
|
||||
assert state.state == "16.8344"
|
||||
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
||||
|
@ -142,11 +142,11 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
== CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
)
|
||||
|
||||
entry = registry.async_get("sensor.home_pm10")
|
||||
entry = registry.async_get("sensor.home_particulate_matter_10_mm")
|
||||
assert entry
|
||||
assert entry.unique_id == "123-pm10"
|
||||
|
||||
state = hass.states.get("sensor.home_pm10_index")
|
||||
state = hass.states.get("sensor.home_particulate_matter_10_mm_index")
|
||||
assert state
|
||||
assert state.state == "good"
|
||||
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
||||
|
@ -160,11 +160,11 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
"very_good",
|
||||
]
|
||||
|
||||
entry = registry.async_get("sensor.home_pm10_index")
|
||||
entry = registry.async_get("sensor.home_particulate_matter_10_mm_index")
|
||||
assert entry
|
||||
assert entry.unique_id == "123-pm10-index"
|
||||
|
||||
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"
|
||||
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
||||
|
@ -175,11 +175,11 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
== CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
)
|
||||
|
||||
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-pm25"
|
||||
|
||||
state = hass.states.get("sensor.home_pm2_5_index")
|
||||
state = hass.states.get("sensor.home_particulate_matter_2_5_mm_index")
|
||||
assert state
|
||||
assert state.state == "good"
|
||||
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
||||
|
@ -193,7 +193,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
"very_good",
|
||||
]
|
||||
|
||||
entry = registry.async_get("sensor.home_pm2_5_index")
|
||||
entry = registry.async_get("sensor.home_particulate_matter_2_5_mm_index")
|
||||
assert entry
|
||||
assert entry.unique_id == "123-pm25-index"
|
||||
|
||||
|
@ -230,7 +230,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
assert entry
|
||||
assert entry.unique_id == "123-so2-index"
|
||||
|
||||
state = hass.states.get("sensor.home_aqi")
|
||||
state = hass.states.get("sensor.home_air_quality_index")
|
||||
assert state
|
||||
assert state.state == "good"
|
||||
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
||||
|
@ -245,7 +245,7 @@ async def test_sensor(hass: HomeAssistant) -> None:
|
|||
"very_good",
|
||||
]
|
||||
|
||||
entry = registry.async_get("sensor.home_aqi")
|
||||
entry = registry.async_get("sensor.home_air_quality_index")
|
||||
assert entry
|
||||
assert entry.unique_id == "123-aqi"
|
||||
|
||||
|
@ -257,15 +257,15 @@ async def test_availability(hass: HomeAssistant) -> None:
|
|||
|
||||
await init_integration(hass)
|
||||
|
||||
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"
|
||||
|
||||
state = hass.states.get("sensor.home_pm2_5_index")
|
||||
state = hass.states.get("sensor.home_particulate_matter_2_5_mm_index")
|
||||
assert state
|
||||
assert state.state == "good"
|
||||
|
||||
state = hass.states.get("sensor.home_aqi")
|
||||
state = hass.states.get("sensor.home_air_quality_index")
|
||||
assert state
|
||||
assert state.state == "good"
|
||||
|
||||
|
@ -277,15 +277,15 @@ async def test_availability(hass: HomeAssistant) -> None:
|
|||
async_fire_time_changed(hass, future)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("sensor.home_pm2_5")
|
||||
state = hass.states.get("sensor.home_particulate_matter_2_5_mm")
|
||||
assert state
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
state = hass.states.get("sensor.home_pm2_5_index")
|
||||
state = hass.states.get("sensor.home_particulate_matter_2_5_mm_index")
|
||||
assert state
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
state = hass.states.get("sensor.home_aqi")
|
||||
state = hass.states.get("sensor.home_air_quality_index")
|
||||
assert state
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
|
@ -300,17 +300,17 @@ async def test_availability(hass: HomeAssistant) -> None:
|
|||
async_fire_time_changed(hass, future)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
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"
|
||||
|
||||
# Indexes are empty so the state should be unavailable
|
||||
state = hass.states.get("sensor.home_aqi")
|
||||
state = hass.states.get("sensor.home_air_quality_index")
|
||||
assert state
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
# Indexes are empty so the state should be unavailable
|
||||
state = hass.states.get("sensor.home_pm2_5_index")
|
||||
state = hass.states.get("sensor.home_particulate_matter_2_5_mm_index")
|
||||
assert state
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
|
@ -324,15 +324,15 @@ async def test_availability(hass: HomeAssistant) -> None:
|
|||
async_fire_time_changed(hass, future)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
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"
|
||||
|
||||
state = hass.states.get("sensor.home_pm2_5_index")
|
||||
state = hass.states.get("sensor.home_particulate_matter_2_5_mm_index")
|
||||
assert state
|
||||
assert state.state == "good"
|
||||
|
||||
state = hass.states.get("sensor.home_aqi")
|
||||
state = hass.states.get("sensor.home_air_quality_index")
|
||||
assert state
|
||||
assert state.state == "good"
|
||||
|
||||
|
@ -349,11 +349,11 @@ async def test_invalid_indexes(hass: HomeAssistant) -> None:
|
|||
assert state
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
state = hass.states.get("sensor.home_pm10_index")
|
||||
state = hass.states.get("sensor.home_particulate_matter_10_mm_index")
|
||||
assert state
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
state = hass.states.get("sensor.home_pm2_5_index")
|
||||
state = hass.states.get("sensor.home_particulate_matter_2_5_mm_index")
|
||||
assert state
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
|
@ -361,7 +361,7 @@ async def test_invalid_indexes(hass: HomeAssistant) -> None:
|
|||
assert state
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
state = hass.states.get("sensor.home_aqi")
|
||||
state = hass.states.get("sensor.home_air_quality_index")
|
||||
assert state is None
|
||||
|
||||
|
||||
|
@ -373,12 +373,12 @@ async def test_unique_id_migration(hass: HomeAssistant) -> None:
|
|||
PLATFORM,
|
||||
DOMAIN,
|
||||
"123-pm2.5",
|
||||
suggested_object_id="home_pm2_5",
|
||||
suggested_object_id="home_particulate_matter_2_5_mm",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
await init_integration(hass)
|
||||
|
||||
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-pm25"
|
||||
|
|
Loading…
Add table
Reference in a new issue