diff --git a/homeassistant/components/gpslogger/device_tracker.py b/homeassistant/components/gpslogger/device_tracker.py index 317f2619bef..4cce9290a68 100644 --- a/homeassistant/components/gpslogger/device_tracker.py +++ b/homeassistant/components/gpslogger/device_tracker.py @@ -66,8 +66,11 @@ async def async_setup_entry( class GPSLoggerEntity(TrackerEntity, RestoreEntity): """Represent a tracked device.""" + _attr_has_entity_name = True + _attr_name = None + def __init__(self, device, location, battery, accuracy, attributes): - """Set up Geofency entity.""" + """Set up GPSLogger entity.""" self._accuracy = accuracy self._attributes = attributes self._name = device @@ -101,11 +104,6 @@ class GPSLoggerEntity(TrackerEntity, RestoreEntity): """Return the gps accuracy of the device.""" return self._accuracy - @property - def name(self): - """Return the name of the device.""" - return self._name - @property def unique_id(self): """Return the unique ID.""" @@ -114,7 +112,10 @@ class GPSLoggerEntity(TrackerEntity, RestoreEntity): @property def device_info(self) -> DeviceInfo: """Return the device info.""" - return DeviceInfo(identifiers={(GPL_DOMAIN, self._unique_id)}, name=self._name) + return DeviceInfo( + identifiers={(GPL_DOMAIN, self._unique_id)}, + name=self._name, + ) @property def source_type(self) -> SourceType: @@ -165,7 +166,7 @@ class GPSLoggerEntity(TrackerEntity, RestoreEntity): @callback def _async_receive_data(self, device, location, battery, accuracy, attributes): """Mark the device as seen.""" - if device != self.name: + if device != self._name: return self._location = location