mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Migrate OwnTracks to has entity name (#96743)
* Migrate OwnTracks to has entity name * Fix test * Fix tests
This commit is contained in:
parent
8937884e33
commit
005e45edcc
@ -59,6 +59,9 @@ async def async_setup_entry(
|
|||||||
class OwnTracksEntity(TrackerEntity, RestoreEntity):
|
class OwnTracksEntity(TrackerEntity, RestoreEntity):
|
||||||
"""Represent a tracked device."""
|
"""Represent a tracked device."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, dev_id, data=None):
|
def __init__(self, dev_id, data=None):
|
||||||
"""Set up OwnTracks entity."""
|
"""Set up OwnTracks entity."""
|
||||||
self._dev_id = dev_id
|
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 a location name for the current location of the device."""
|
||||||
return self._data.get("location_name")
|
return self._data.get("location_name")
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the device."""
|
|
||||||
return self._data.get("host_name")
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source_type(self) -> SourceType:
|
def source_type(self) -> SourceType:
|
||||||
"""Return the source type, eg gps or router, of the device."""
|
"""Return the source type, eg gps or router, of the device."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user