mirror of
https://github.com/elisspace/core.git
synced 2026-10-05 16:56:19 +00:00
Prevent accidental device reg override (#17136)
This commit is contained in:
@@ -275,17 +275,24 @@ class EntityPlatform:
|
||||
device_info = entity.device_info
|
||||
|
||||
if config_entry_id is not None and device_info is not None:
|
||||
processed_dev_info = {
|
||||
'config_entry_id': config_entry_id
|
||||
}
|
||||
for key in (
|
||||
'connections',
|
||||
'identifiers',
|
||||
'manufacturer',
|
||||
'model',
|
||||
'name',
|
||||
'sw_version',
|
||||
'via_hub',
|
||||
):
|
||||
if key in device_info:
|
||||
processed_dev_info[key] = device_info[key]
|
||||
|
||||
device = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry_id,
|
||||
connections=device_info.get('connections') or set(),
|
||||
identifiers=device_info.get('identifiers') or set(),
|
||||
manufacturer=device_info.get('manufacturer'),
|
||||
model=device_info.get('model'),
|
||||
name=device_info.get('name'),
|
||||
sw_version=device_info.get('sw_version'),
|
||||
via_hub=device_info.get('via_hub'))
|
||||
if device:
|
||||
device_id = device.id
|
||||
**processed_dev_info)
|
||||
device_id = device.id
|
||||
else:
|
||||
device_id = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user