Add device info to Life360 (#98772)

pull/96083/head^2
Joost Lekkerkerker 2023-08-22 09:28:47 +02:00 committed by GitHub
parent a0a06f16a7
commit a89c0c944a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -10,6 +10,7 @@ from homeassistant.components.device_tracker import SourceType, TrackerEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_BATTERY_CHARGING
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity
@ -111,6 +112,7 @@ class Life360DeviceTracker(
self._prev_data = self._data
self._attr_name = self._data.name
self._name = self._data.name
self._attr_entity_picture = self._data.entity_picture
# Server sends a pair of address values on alternate updates. Keep the pair of
@ -124,6 +126,11 @@ class Life360DeviceTracker(
address = None
self._addresses = [address]
@property
def device_info(self) -> DeviceInfo:
"""Return device info."""
return DeviceInfo(identifiers={(DOMAIN, self._attr_unique_id)}, name=self._name)
@property
def _options(self) -> Mapping[str, Any]:
"""Shortcut to config entry options."""