mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 13:34:58 +00:00
Compare commits
2 Commits
fix-backup
...
remove_dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e702d077f4 | ||
|
|
35314fb9ed |
@@ -470,7 +470,7 @@ async def async_load_base_functionality(hass: core.HomeAssistant) -> bool:
|
||||
translation.async_setup(hass)
|
||||
|
||||
recovery = hass.config.recovery_mode
|
||||
device_registry.async_setup(hass)
|
||||
device_registry.async_get(hass)
|
||||
try:
|
||||
await asyncio.gather(
|
||||
create_eager_task(get_internal_store_manager(hass).async_initialize()),
|
||||
|
||||
@@ -772,11 +772,11 @@ class DeviceRegistry(BaseRegistry[dict[str, list[dict[str, Any]]]]):
|
||||
devices: ActiveDeviceRegistryItems
|
||||
deleted_devices: DeviceRegistryItems[DeletedDeviceEntry]
|
||||
_device_data: dict[str, DeviceEntry]
|
||||
_loaded_event: asyncio.Event | None = None
|
||||
|
||||
def __init__(self, hass: HomeAssistant) -> None:
|
||||
"""Initialize the device registry."""
|
||||
self.hass = hass
|
||||
self._loaded_event = asyncio.Event()
|
||||
self._store = DeviceRegistryStore(
|
||||
hass,
|
||||
STORAGE_VERSION_MAJOR,
|
||||
@@ -786,11 +786,6 @@ class DeviceRegistry(BaseRegistry[dict[str, list[dict[str, Any]]]]):
|
||||
serialize_in_event_loop=False,
|
||||
)
|
||||
|
||||
@callback
|
||||
def async_setup(self) -> None:
|
||||
"""Set up the registry."""
|
||||
self._loaded_event = asyncio.Event()
|
||||
|
||||
@callback
|
||||
def async_get(self, device_id: str) -> DeviceEntry | None:
|
||||
"""Get device.
|
||||
@@ -1470,9 +1465,6 @@ class DeviceRegistry(BaseRegistry[dict[str, list[dict[str, Any]]]]):
|
||||
|
||||
async def _async_load(self) -> None:
|
||||
"""Load the device registry."""
|
||||
assert self._loaded_event is not None
|
||||
assert not self._loaded_event.is_set()
|
||||
|
||||
async_setup_cleanup(self.hass, self)
|
||||
|
||||
data = await self._store.async_load()
|
||||
@@ -1577,8 +1569,7 @@ class DeviceRegistry(BaseRegistry[dict[str, list[dict[str, Any]]]]):
|
||||
|
||||
Will only wait if the registry had already been set up.
|
||||
"""
|
||||
if self._loaded_event is not None:
|
||||
await self._loaded_event.wait()
|
||||
await self._loaded_event.wait()
|
||||
|
||||
@callback
|
||||
def _data_to_save(self) -> dict[str, Any]:
|
||||
@@ -1726,12 +1717,6 @@ def async_get(hass: HomeAssistant) -> DeviceRegistry:
|
||||
return DeviceRegistry(hass)
|
||||
|
||||
|
||||
def async_setup(hass: HomeAssistant) -> None:
|
||||
"""Set up device registry."""
|
||||
assert DATA_REGISTRY not in hass.data
|
||||
async_get(hass).async_setup()
|
||||
|
||||
|
||||
async def async_load(hass: HomeAssistant, *, load_empty: bool = False) -> None:
|
||||
"""Load device registry."""
|
||||
await async_get(hass).async_load(load_empty=load_empty)
|
||||
|
||||
@@ -55,7 +55,6 @@ def run(args: Sequence[str] | None) -> None:
|
||||
async def run_command(args: argparse.Namespace) -> None:
|
||||
"""Run the command."""
|
||||
hass = HomeAssistant(os.path.join(os.getcwd(), args.config))
|
||||
dr.async_setup(hass)
|
||||
await asyncio.gather(dr.async_load(hass), er.async_load(hass))
|
||||
hass.auth = await auth_manager_from_config(hass, [{"type": "homeassistant"}], [])
|
||||
provider = hass.auth.auth_providers[0]
|
||||
|
||||
@@ -302,7 +302,6 @@ async def async_check_config(config_dir):
|
||||
hass = core.HomeAssistant(config_dir)
|
||||
loader.async_setup(hass)
|
||||
hass.config_entries = ConfigEntries(hass, {})
|
||||
dr.async_setup(hass)
|
||||
await ar.async_load(hass)
|
||||
await dr.async_load(hass)
|
||||
await er.async_load(hass)
|
||||
|
||||
@@ -305,8 +305,6 @@ async def async_test_home_assistant(
|
||||
hass
|
||||
)
|
||||
if load_registries:
|
||||
dr.async_setup(hass)
|
||||
|
||||
with (
|
||||
patch.object(StoreWithoutWriteLoad, "async_load", return_value=None),
|
||||
patch(
|
||||
|
||||
@@ -363,7 +363,6 @@ async def test_loading_from_storage(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
assert len(registry.devices) == 1
|
||||
@@ -501,7 +500,6 @@ async def test_migration_from_1_1(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
|
||||
@@ -656,7 +654,6 @@ async def test_migration_from_1_2(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
|
||||
@@ -793,7 +790,6 @@ async def test_migration_fom_1_3(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
|
||||
@@ -932,7 +928,6 @@ async def test_migration_from_1_4(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
|
||||
@@ -1073,7 +1068,6 @@ async def test_migration_from_1_5(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
|
||||
@@ -1216,7 +1210,6 @@ async def test_migration_from_1_6(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
|
||||
@@ -1361,7 +1354,6 @@ async def test_migration_from_1_7(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
|
||||
@@ -1504,7 +1496,6 @@ async def test_migration_from_1_10(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
|
||||
@@ -1641,7 +1632,6 @@ async def test_migration_from_1_11(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
|
||||
@@ -3793,7 +3783,6 @@ async def test_cleanup_entity_registry_change(
|
||||
Don't pre-load the registries as the debouncer will then not be waiting for
|
||||
EVENT_ENTITY_REGISTRY_UPDATED events.
|
||||
"""
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
await er.async_load(hass)
|
||||
dev_reg = dr.async_get(hass)
|
||||
@@ -4955,7 +4944,6 @@ async def test_loading_invalid_configuration_url_from_storage(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
registry = dr.async_get(hass)
|
||||
assert len(registry.devices) == 1
|
||||
|
||||
@@ -536,8 +536,6 @@ async def test_entity_registry_loading_waits_for_device_registry(
|
||||
await asyncio.sleep(0)
|
||||
return await original_load(self)
|
||||
|
||||
dr.async_setup(hass)
|
||||
|
||||
with patch.object(dr.DeviceRegistryStore, "async_load", delayed_load):
|
||||
await asyncio.gather(
|
||||
er.async_load(hass),
|
||||
@@ -1676,7 +1674,6 @@ async def test_migration_1_21(
|
||||
},
|
||||
}
|
||||
|
||||
dr.async_setup(hass)
|
||||
await dr.async_load(hass)
|
||||
|
||||
entity_base = {
|
||||
|
||||
Reference in New Issue
Block a user