mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Migrate Traccar to has entity naming (#96760)
This commit is contained in:
parent
9e67bccb89
commit
2c949d56dc
@ -365,8 +365,11 @@ class TraccarScanner:
|
||||
class TraccarEntity(TrackerEntity, RestoreEntity):
|
||||
"""Represent a tracked device."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = None
|
||||
|
||||
def __init__(self, device, latitude, longitude, battery, accuracy, attributes):
|
||||
"""Set up Geofency entity."""
|
||||
"""Set up Traccar entity."""
|
||||
self._accuracy = accuracy
|
||||
self._attributes = attributes
|
||||
self._name = device
|
||||
@ -401,11 +404,6 @@ class TraccarEntity(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."""
|
||||
@ -468,7 +466,7 @@ class TraccarEntity(TrackerEntity, RestoreEntity):
|
||||
self, device, latitude, longitude, battery, accuracy, attributes
|
||||
):
|
||||
"""Mark the device as seen."""
|
||||
if device != self.name:
|
||||
if device != self._name:
|
||||
return
|
||||
|
||||
self._latitude = latitude
|
||||
|
Loading…
x
Reference in New Issue
Block a user