Migrate OwnTracks to has entity name (#96743)

* Migrate OwnTracks to has entity name

* Fix test

* Fix tests
This commit is contained in:
Joost Lekkerkerker 2023-07-17 14:55:34 +02:00 committed by GitHub
parent 8937884e33
commit 005e45edcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,6 +59,9 @@ async def async_setup_entry(
class OwnTracksEntity(TrackerEntity, RestoreEntity):
"""Represent a tracked device."""
_attr_has_entity_name = True
_attr_name = None
def __init__(self, dev_id, data=None):
"""Set up OwnTracks entity."""
self._dev_id = dev_id
@ -108,11 +111,6 @@ class OwnTracksEntity(TrackerEntity, RestoreEntity):
"""Return a location name for the current location of the device."""
return self._data.get("location_name")
@property
def name(self):
"""Return the name of the device."""
return self._data.get("host_name")
@property
def source_type(self) -> SourceType:
"""Return the source type, eg gps or router, of the device."""