Use shorthand attributes in iCloud (#99390)
* Use shorthand attributes in iCloud * Use shorthand attributes in iCloudpull/99397/head
parent
2c545ef3d2
commit
7ead5c44ea
|
@ -64,11 +64,7 @@ class IcloudTrackerEntity(TrackerEntity):
|
|||
self._account = account
|
||||
self._device = device
|
||||
self._unsub_dispatcher: CALLBACK_TYPE | None = None
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Return a unique ID."""
|
||||
return self._device.unique_id
|
||||
self._attr_unique_id = device.unique_id
|
||||
|
||||
@property
|
||||
def location_accuracy(self):
|
||||
|
|
|
@ -63,11 +63,14 @@ class IcloudDeviceBatterySensor(SensorEntity):
|
|||
self._account = account
|
||||
self._device = device
|
||||
self._unsub_dispatcher: CALLBACK_TYPE | None = None
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Return a unique ID."""
|
||||
return f"{self._device.unique_id}_battery"
|
||||
self._attr_unique_id = f"{device.unique_id}_battery"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
configuration_url="https://icloud.com/",
|
||||
identifiers={(DOMAIN, device.unique_id)},
|
||||
manufacturer="Apple",
|
||||
model=device.device_model,
|
||||
name=device.name,
|
||||
)
|
||||
|
||||
@property
|
||||
def native_value(self) -> int | None:
|
||||
|
@ -87,17 +90,6 @@ class IcloudDeviceBatterySensor(SensorEntity):
|
|||
"""Return default attributes for the iCloud device entity."""
|
||||
return self._device.extra_state_attributes
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return DeviceInfo(
|
||||
configuration_url="https://icloud.com/",
|
||||
identifiers={(DOMAIN, self._device.unique_id)},
|
||||
manufacturer="Apple",
|
||||
model=self._device.device_model,
|
||||
name=self._device.name,
|
||||
)
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register state update callback."""
|
||||
self._unsub_dispatcher = async_dispatcher_connect(
|
||||
|
|
Loading…
Reference in New Issue