mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Fix race in entity_platform.async_add_entities (#19222)
This commit is contained in:
parent
d425aabae3
commit
a262d0f9e4
@ -297,7 +297,8 @@ class EntityPlatform:
|
||||
self.domain, self.platform_name, entity.unique_id,
|
||||
suggested_object_id=suggested_object_id,
|
||||
config_entry_id=config_entry_id,
|
||||
device_id=device_id)
|
||||
device_id=device_id,
|
||||
known_object_ids=self.entities.keys())
|
||||
|
||||
if entry.disabled:
|
||||
self.logger.info(
|
||||
|
@ -117,7 +117,7 @@ class EntityRegistry:
|
||||
@callback
|
||||
def async_get_or_create(self, domain, platform, unique_id, *,
|
||||
suggested_object_id=None, config_entry_id=None,
|
||||
device_id=None):
|
||||
device_id=None, known_object_ids=None):
|
||||
"""Get entity. Create if it doesn't exist."""
|
||||
entity_id = self.async_get_entity_id(domain, platform, unique_id)
|
||||
if entity_id:
|
||||
@ -126,7 +126,8 @@ class EntityRegistry:
|
||||
device_id=device_id)
|
||||
|
||||
entity_id = self.async_generate_entity_id(
|
||||
domain, suggested_object_id or '{}_{}'.format(platform, unique_id))
|
||||
domain, suggested_object_id or '{}_{}'.format(platform, unique_id),
|
||||
known_object_ids)
|
||||
|
||||
entity = RegistryEntry(
|
||||
entity_id=entity_id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user