mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +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):
|
class TraccarEntity(TrackerEntity, RestoreEntity):
|
||||||
"""Represent a tracked device."""
|
"""Represent a tracked device."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, device, latitude, longitude, battery, accuracy, attributes):
|
def __init__(self, device, latitude, longitude, battery, accuracy, attributes):
|
||||||
"""Set up Geofency entity."""
|
"""Set up Traccar entity."""
|
||||||
self._accuracy = accuracy
|
self._accuracy = accuracy
|
||||||
self._attributes = attributes
|
self._attributes = attributes
|
||||||
self._name = device
|
self._name = device
|
||||||
@ -401,11 +404,6 @@ class TraccarEntity(TrackerEntity, RestoreEntity):
|
|||||||
"""Return the gps accuracy of the device."""
|
"""Return the gps accuracy of the device."""
|
||||||
return self._accuracy
|
return self._accuracy
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the device."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""Return the unique ID."""
|
"""Return the unique ID."""
|
||||||
@ -468,7 +466,7 @@ class TraccarEntity(TrackerEntity, RestoreEntity):
|
|||||||
self, device, latitude, longitude, battery, accuracy, attributes
|
self, device, latitude, longitude, battery, accuracy, attributes
|
||||||
):
|
):
|
||||||
"""Mark the device as seen."""
|
"""Mark the device as seen."""
|
||||||
if device != self.name:
|
if device != self._name:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._latitude = latitude
|
self._latitude = latitude
|
||||||
|
Loading…
x
Reference in New Issue
Block a user