1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add default_* to device registry (#38829)

This commit is contained in:
Paulus Schoutsen
2020-08-13 10:38:56 +02:00
committed by GitHub
parent a6cec21c43
commit b3571602bb
5 changed files with 59 additions and 5 deletions

View File

@@ -209,6 +209,9 @@ class DeviceRegistry:
manufacturer=_UNDEF,
model=_UNDEF,
name=_UNDEF,
default_manufacturer=_UNDEF,
default_model=_UNDEF,
default_name=_UNDEF,
sw_version=_UNDEF,
entry_type=_UNDEF,
via_device=None,
@@ -236,6 +239,16 @@ class DeviceRegistry:
device = deleted_device.to_device_entry()
self._add_device(device)
else:
if default_manufacturer and not device.manufacturer:
manufacturer = default_manufacturer
if default_model and not device.model:
model = default_model
if default_name and not device.name:
name = default_name
if via_device is not None:
via = self.async_get_device({via_device}, set())
via_device_id = via.id if via else _UNDEF