1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-26 14:08:21 +00:00

Fix device reg considered changed (#17764)

* Fix device reg considered changed

* Better syntax
This commit is contained in:
Paulus Schoutsen
2018-10-25 16:43:11 +02:00
committed by Pascal Vizeli
parent b6e8cafdea
commit b5284aa445
2 changed files with 24 additions and 3 deletions

View File

@@ -87,8 +87,8 @@ class DeviceRegistry:
device.id,
add_config_entry_id=config_entry_id,
hub_device_id=hub_device_id,
merge_connections=connections,
merge_identifiers=identifiers,
merge_connections=connections or _UNDEF,
merge_identifiers=identifiers or _UNDEF,
manufacturer=manufacturer,
model=model,
name=name,
@@ -128,7 +128,8 @@ class DeviceRegistry:
('identifiers', merge_identifiers),
):
old_value = getattr(old, attr_name)
if value is not _UNDEF and value != old_value:
# If not undefined, check if `value` contains new items.
if value is not _UNDEF and not value.issubset(old_value):
changes[attr_name] = old_value | value
for attr_name, value in (