1 """Device Tracker platform for Tesla Fleet integration."""
3 from __future__
import annotations
12 from .entity
import TeslaFleetVehicleEntity
13 from .models
import TeslaFleetVehicleData
17 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
19 """Set up the Tesla Fleet device tracker platform from a config entry."""
24 TeslaFleetDeviceTrackerLocationEntity,
25 TeslaFleetDeviceTrackerRouteEntity,
27 for vehicle
in entry.runtime_data.vehicles
32 TeslaFleetVehicleEntity, TrackerEntity, RestoreEntity
34 """Base class for Tesla Fleet device tracker entities."""
38 vehicle: TeslaFleetVehicleData,
40 """Initialize the device tracker."""
44 """Handle entity which will be added."""
56 """Vehicle Location device tracker Class."""
61 """Update the attributes of the entity."""
66 self.
getget(
"drive_state_longitude",
False)
is None
67 or self.
getget(
"drive_state_latitude",
False)
is None
72 """Vehicle Navigation device tracker Class."""
77 """Update the attributes of the device tracker."""
81 self.
getget(
"drive_state_active_route_longitude",
False)
is None
82 or self.
getget(
"drive_state_active_route_latitude",
False)
is None
87 """Return a location name for the current location of the device."""
88 location = self.
getget(
"drive_state_active_route_destination")
89 if location ==
"Home":
None __init__(self, TeslaFleetVehicleData vehicle)
None async_added_to_hass(self)
None _async_update_attrs(self)
str|None location_name(self)
None _async_update_attrs(self)
Any|None get(self, str key, Any|None default=None)
State|None async_get_last_state(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)