Add entity translations to iCloud (#95461)
parent
fe0d33d97c
commit
d708c159e7
|
@ -56,6 +56,9 @@ def add_entities(account: IcloudAccount, async_add_entities, tracked):
|
|||
class IcloudTrackerEntity(TrackerEntity):
|
||||
"""Represent a tracked device."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = None
|
||||
|
||||
def __init__(self, account: IcloudAccount, device: IcloudDevice) -> None:
|
||||
"""Set up the iCloud tracker entity."""
|
||||
self._account = account
|
||||
|
@ -67,11 +70,6 @@ class IcloudTrackerEntity(TrackerEntity):
|
|||
"""Return a unique ID."""
|
||||
return self._device.unique_id
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of the device."""
|
||||
return self._device.name
|
||||
|
||||
@property
|
||||
def location_accuracy(self):
|
||||
"""Return the location accuracy of the device."""
|
||||
|
|
|
@ -56,6 +56,7 @@ class IcloudDeviceBatterySensor(SensorEntity):
|
|||
_attr_device_class = SensorDeviceClass.BATTERY
|
||||
_attr_native_unit_of_measurement = PERCENTAGE
|
||||
_attr_should_poll = False
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, account: IcloudAccount, device: IcloudDevice) -> None:
|
||||
"""Initialize the battery sensor."""
|
||||
|
@ -68,11 +69,6 @@ class IcloudDeviceBatterySensor(SensorEntity):
|
|||
"""Return a unique ID."""
|
||||
return f"{self._device.unique_id}_battery"
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Sensor name."""
|
||||
return f"{self._device.name} battery state"
|
||||
|
||||
@property
|
||||
def native_value(self) -> int | None:
|
||||
"""Battery state percentage."""
|
||||
|
|
Loading…
Reference in New Issue