mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Minor improvement of device_registry (#128075)
* Minor improvement of device_registry * Remove uncovered line
This commit is contained in:
parent
50025971d8
commit
8ba14ef113
@ -955,11 +955,11 @@ class DeviceRegistry(BaseRegistry[dict[str, list[dict[str, Any]]]]):
|
|||||||
area = ar.async_get(self.hass).async_get_or_create(suggested_area)
|
area = ar.async_get(self.hass).async_get_or_create(suggested_area)
|
||||||
area_id = area.id
|
area_id = area.id
|
||||||
|
|
||||||
if add_config_entry is not UNDEFINED:
|
if add_config_entry_id is not UNDEFINED:
|
||||||
primary_entry_id = old.primary_config_entry
|
primary_entry_id = old.primary_config_entry
|
||||||
if (
|
if (
|
||||||
device_info_type == "primary"
|
device_info_type == "primary"
|
||||||
and add_config_entry.entry_id != primary_entry_id
|
and add_config_entry_id != primary_entry_id
|
||||||
):
|
):
|
||||||
if (
|
if (
|
||||||
primary_entry_id is None
|
primary_entry_id is None
|
||||||
@ -970,11 +970,11 @@ class DeviceRegistry(BaseRegistry[dict[str, list[dict[str, Any]]]]):
|
|||||||
)
|
)
|
||||||
or primary_entry.domain in LOW_PRIO_CONFIG_ENTRY_DOMAINS
|
or primary_entry.domain in LOW_PRIO_CONFIG_ENTRY_DOMAINS
|
||||||
):
|
):
|
||||||
new_values["primary_config_entry"] = add_config_entry.entry_id
|
new_values["primary_config_entry"] = add_config_entry_id
|
||||||
old_values["primary_config_entry"] = old.primary_config_entry
|
old_values["primary_config_entry"] = primary_entry_id
|
||||||
|
|
||||||
if add_config_entry.entry_id not in old.config_entries:
|
if add_config_entry_id not in old.config_entries:
|
||||||
config_entries = old.config_entries | {add_config_entry.entry_id}
|
config_entries = old.config_entries | {add_config_entry_id}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
remove_config_entry_id is not UNDEFINED
|
remove_config_entry_id is not UNDEFINED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user