Simplify device registry update (#62868)

This commit is contained in:
Ville Skyttä 2022-01-04 16:02:11 +02:00 committed by GitHub
parent 8d2cb82b1d
commit 5231bc5dcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -522,6 +522,8 @@ class DeviceRegistry:
("manufacturer", manufacturer),
("model", model),
("name", name),
("name_by_user", name_by_user),
("area_id", area_id),
("suggested_area", suggested_area),
("sw_version", sw_version),
("hw_version", hw_version),
@ -530,12 +532,6 @@ class DeviceRegistry:
if value is not UNDEFINED and value != getattr(old, attr_name):
changes[attr_name] = value
if area_id is not UNDEFINED and area_id != old.area_id:
changes["area_id"] = area_id
if name_by_user is not UNDEFINED and name_by_user != old.name_by_user:
changes["name_by_user"] = name_by_user
if old.is_new:
changes["is_new"] = False