Repository: home-assistant/core
File: homeassistant/components/tractive/__init__.py (Python)

Code before:
    if not trackable.get("device_id"):
        return None

    if "details" not in trackable:
        _LOGGER.warning(
            "Tracker %s has no details and will be skipped. This happens for shared trackers",
            trackable["device_id"],
        )
        return None

    tracker = client.tracker(trackable["device_id"])
    trackable_obj = client.trackable_object(trackable["_id"])

    tracker_details, hw_info, pos_report = await asyncio.gather(
        tracker.details(), tracker.hw_info(), tracker.pos_report()
    )

    if not tracker_details.get("_id"):
        raise ConfigEntryNotReady(
            f"Tractive API returns incomplete data for tracker {trackable['device_id']}",
        )

    # Fetch health overview data (replaces deprecated wellness_overview)
    health_overview = None
    try:
        health_overview = await trackable_obj.health_overview()
    except aiotractive.exceptions.TractiveError:
        _LOGGER.debug(
            "Could not fetch health overview for pet %s, continuing without it",
            trackable["_id"],
        )

    return Trackables(
        tracker, trackable, tracker_details, hw_info, pos_report, health_overview
    )


async def async_unload_entry(hass: HomeAssistant, entry: TractiveConfigEntry) -> bool:
    """Unload a config entry."""
    return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)


class TractiveClient:
    """A Tractive client."""

    def __init__(
        self,
        hass: HomeAssistant,
        client: aiotractive.Tractive,
        user_id: str,
        config_entry: ConfigEntry,

Review comment (suggestion):
We can add `trackable_obj.health_overview()` to the `asyncio.gather()` in the line 155:

```python
tracker_details, hw_info, pos_report, health_overview = await asyncio.gather(
        tracker.details(), tracker.hw_info(), tracker.pos_report(), trackable_obj.health_overview()
    ) 
```

Code after:
    # Check that the pet has tracker linked.
    if not trackable.get("device_id"):
        return None

    if "details" not in trackable:
        _LOGGER.warning(
            "Tracker %s has no details and will be skipped. This happens for shared trackers",
            trackable["device_id"],
        )
        return None

    tracker = client.tracker(trackable["device_id"])
    trackable_pet = client.trackable_object(trackable["_id"])

    tracker_details, hw_info, pos_report, health_overview = await asyncio.gather(
        tracker.details(),
        tracker.hw_info(),
        tracker.pos_report(),
        trackable_pet.health_overview(),
    )

    if not tracker_details.get("_id"):
        raise ConfigEntryNotReady(
            f"Tractive API returns incomplete data for tracker {trackable['device_id']}",
        )

    return Trackables(
        tracker, trackable, tracker_details, hw_info, pos_report, health_overview
    )


async def async_unload_entry(hass: HomeAssistant, entry: TractiveConfigEntry) -> bool:
    """Unload a config entry."""
    return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)


class TractiveClient:
    """A Tractive client."""

    def __init__(
        self,
        hass: HomeAssistant,
        client: aiotractive.Tractive,
        user_id: str,
        config_entry: ConfigEntry,
    ) -> None:
        """Initialize the client."""
        self._hass = hass
        self._client = client
        self._user_id = user_id
        self._last_hw_time = 0