mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Remove async_get_device_class_lookup from entity_registry (#114212)
This function was only ever used in homekit, and since there is now an index of devices in the entity registry, homekit no longer uses it. I searched github code for all references to async_get_device_class_lookup and the only think I could find using it were forks of core. It seems unlikely that any custom components are affected by removing this function
This commit is contained in:
@@ -954,85 +954,6 @@ async def test_restore_states(
|
||||
assert hass.states.get("light.all_info_set") is None
|
||||
|
||||
|
||||
async def test_async_get_device_class_lookup(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test registry device class lookup."""
|
||||
hass.set_state(CoreState.not_running)
|
||||
|
||||
entity_registry.async_get_or_create(
|
||||
"binary_sensor",
|
||||
"light",
|
||||
"battery_charging",
|
||||
device_id="light_device_entry_id",
|
||||
original_device_class="battery_charging",
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"sensor",
|
||||
"light",
|
||||
"battery",
|
||||
device_id="light_device_entry_id",
|
||||
original_device_class="battery",
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"light", "light", "demo", device_id="light_device_entry_id"
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"binary_sensor",
|
||||
"vacuum",
|
||||
"battery_charging",
|
||||
device_id="vacuum_device_entry_id",
|
||||
original_device_class="battery_charging",
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"sensor",
|
||||
"vacuum",
|
||||
"battery",
|
||||
device_id="vacuum_device_entry_id",
|
||||
original_device_class="battery",
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"vacuum", "vacuum", "demo", device_id="vacuum_device_entry_id"
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"binary_sensor",
|
||||
"remote",
|
||||
"battery_charging",
|
||||
device_id="remote_device_entry_id",
|
||||
original_device_class="battery_charging",
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"remote", "remote", "demo", device_id="remote_device_entry_id"
|
||||
)
|
||||
|
||||
device_lookup = entity_registry.async_get_device_class_lookup(
|
||||
{("binary_sensor", "battery_charging"), ("sensor", "battery")}
|
||||
)
|
||||
|
||||
assert device_lookup == {
|
||||
"remote_device_entry_id": {
|
||||
(
|
||||
"binary_sensor",
|
||||
"battery_charging",
|
||||
): "binary_sensor.remote_battery_charging"
|
||||
},
|
||||
"light_device_entry_id": {
|
||||
(
|
||||
"binary_sensor",
|
||||
"battery_charging",
|
||||
): "binary_sensor.light_battery_charging",
|
||||
("sensor", "battery"): "sensor.light_battery",
|
||||
},
|
||||
"vacuum_device_entry_id": {
|
||||
(
|
||||
"binary_sensor",
|
||||
"battery_charging",
|
||||
): "binary_sensor.vacuum_battery_charging",
|
||||
("sensor", "battery"): "sensor.vacuum_battery",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
async def test_remove_device_removes_entities(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
|
||||
Reference in New Issue
Block a user