prevent dev_id being permanently assigned as config_name (#31886)

This commit is contained in:
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

View File

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