mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 03:03:17 +01:00
Bump aiotractive to 1.0.0 (#161470)
This commit is contained in:
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
from dataclasses import dataclass
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
import aiotractive
|
||||
|
||||
@@ -60,11 +60,11 @@ class Trackables:
|
||||
"""A class that describes trackables."""
|
||||
|
||||
tracker: aiotractive.tracker.Tracker
|
||||
trackable: dict
|
||||
tracker_details: dict
|
||||
hw_info: dict
|
||||
pos_report: dict
|
||||
health_overview: dict
|
||||
trackable: dict[str, Any]
|
||||
tracker_details: dict[str, Any]
|
||||
hw_info: dict[str, Any]
|
||||
pos_report: dict[str, Any]
|
||||
health_overview: dict[str, Any]
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@@ -97,6 +97,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: TractiveConfigEntry) ->
|
||||
await client.close()
|
||||
raise ConfigEntryNotReady from error
|
||||
|
||||
if TYPE_CHECKING:
|
||||
assert creds is not None
|
||||
|
||||
tractive = TractiveClient(hass, client, creds["user_id"], entry)
|
||||
|
||||
try:
|
||||
@@ -145,21 +148,21 @@ async def _generate_trackables(
|
||||
trackable: aiotractive.trackable_object.TrackableObject,
|
||||
) -> Trackables | None:
|
||||
"""Generate trackables."""
|
||||
trackable = await trackable.details()
|
||||
trackable_data = await trackable.details()
|
||||
|
||||
# Check that the pet has tracker linked.
|
||||
if not trackable.get("device_id"):
|
||||
if not trackable_data.get("device_id"):
|
||||
return None
|
||||
|
||||
if "details" not in trackable:
|
||||
if "details" not in trackable_data:
|
||||
_LOGGER.warning(
|
||||
"Tracker %s has no details and will be skipped. This happens for shared trackers",
|
||||
trackable["device_id"],
|
||||
trackable_data["device_id"],
|
||||
)
|
||||
return None
|
||||
|
||||
tracker = client.tracker(trackable["device_id"])
|
||||
trackable_pet = client.trackable_object(trackable["_id"])
|
||||
tracker = client.tracker(trackable_data["device_id"])
|
||||
trackable_pet = client.trackable_object(trackable_data["_id"])
|
||||
|
||||
tracker_details, hw_info, pos_report, health_overview = await asyncio.gather(
|
||||
tracker.details(),
|
||||
@@ -170,11 +173,11 @@ async def _generate_trackables(
|
||||
|
||||
if not tracker_details.get("_id"):
|
||||
raise ConfigEntryNotReady(
|
||||
f"Tractive API returns incomplete data for tracker {trackable['device_id']}",
|
||||
f"Tractive API returns incomplete data for tracker {trackable_data['device_id']}",
|
||||
)
|
||||
|
||||
return Trackables(
|
||||
tracker, trackable, tracker_details, hw_info, pos_report, health_overview
|
||||
tracker, trackable_data, tracker_details, hw_info, pos_report, health_overview
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
"integration_type": "device",
|
||||
"iot_class": "cloud_push",
|
||||
"loggers": ["aiotractive"],
|
||||
"requirements": ["aiotractive==0.7.0"]
|
||||
"requirements": ["aiotractive==1.0.0"]
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import logging
|
||||
from typing import Any, Literal, cast
|
||||
from typing import Any, Literal
|
||||
|
||||
from aiotractive.exceptions import TractiveError
|
||||
|
||||
@@ -136,14 +136,12 @@ class TractiveSwitch(TractiveEntity, SwitchEntity):
|
||||
|
||||
async def async_set_buzzer(self, active: bool) -> dict[str, Any]:
|
||||
"""Set the buzzer on/off."""
|
||||
return cast(dict[str, Any], await self._tracker.set_buzzer_active(active))
|
||||
return await self._tracker.set_buzzer_active(active)
|
||||
|
||||
async def async_set_led(self, active: bool) -> dict[str, Any]:
|
||||
"""Set the LED on/off."""
|
||||
return cast(dict[str, Any], await self._tracker.set_led_active(active))
|
||||
return await self._tracker.set_led_active(active)
|
||||
|
||||
async def async_set_live_tracking(self, active: bool) -> dict[str, Any]:
|
||||
"""Set the live tracking on/off."""
|
||||
return cast(
|
||||
dict[str, Any], await self._tracker.set_live_tracking_active(active)
|
||||
)
|
||||
return await self._tracker.set_live_tracking_active(active)
|
||||
|
||||
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@@ -420,7 +420,7 @@ aiotankerkoenig==0.4.2
|
||||
aiotedee==0.2.25
|
||||
|
||||
# homeassistant.components.tractive
|
||||
aiotractive==0.7.0
|
||||
aiotractive==1.0.0
|
||||
|
||||
# homeassistant.components.unifi
|
||||
aiounifi==88
|
||||
|
||||
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@@ -405,7 +405,7 @@ aiotankerkoenig==0.4.2
|
||||
aiotedee==0.2.25
|
||||
|
||||
# homeassistant.components.tractive
|
||||
aiotractive==0.7.0
|
||||
aiotractive==1.0.0
|
||||
|
||||
# homeassistant.components.unifi
|
||||
aiounifi==88
|
||||
|
||||
Reference in New Issue
Block a user