prevent dev_id being permanently assigned as config_name (#31886)

pull/31902/head
mueslo 2020-02-17 06:07:49 +01:00 committed by GitHub
parent 56142ba085
commit 00b3efec89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -197,7 +197,6 @@ class DeviceTracker:
self.track_new,
dev_id,
mac,
(host_name or dev_id).replace("_", " "),
picture=picture,
icon=icon,
hide_if_away=self.defaults.get(CONF_AWAY_HIDE, DEFAULT_AWAY_HIDE),
@ -342,7 +341,7 @@ class Device(RestoreEntity):
@property
def name(self):
"""Return the name of the entity."""
return self.config_name or self.host_name or DEVICE_DEFAULT_NAME
return self.config_name or self.host_name or self.dev_id or DEVICE_DEFAULT_NAME
@property
def state(self):
@ -393,7 +392,7 @@ class Device(RestoreEntity):
"""Mark the device as seen."""
self.source_type = source_type
self.last_seen = dt_util.utcnow()
self.host_name = host_name
self.host_name = host_name or self.host_name
self.location_name = location_name
self.consider_home = consider_home or self.consider_home