Skip to content

Commit

Permalink
Working location
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Feb 7, 2024
1 parent 692ff98 commit fea8740
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 12 additions & 10 deletions custom_components/teslemetry/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
ENERGY_LIVE_INTERVAL = timedelta(seconds=30)
ENERGY_INFO_INTERVAL = timedelta(seconds=300)

ENDPOINTS = [
VehicleDataEndpoints.CHARGE_STATE,
VehicleDataEndpoints.CLIMATE_STATE,
#VehicleDataEndpoints.CLOSURES_STATE,
VehicleDataEndpoints.DRIVE_STATE,
#VehicleDataEndpoints.GUI_SETTINGS,
VehicleDataEndpoints.LOCATION_DATA,
#VehicleDataEndpoints.VEHICLE_CONFIG,
VehicleDataEndpoints.VEHICLE_STATE,
]
#

def flatten(data: dict[str, Any], parent: str | None = None) -> dict[str, Any]:
"""Flatten the data structure."""
Expand Down Expand Up @@ -49,16 +60,7 @@ async def _async_update_data(self) -> dict[str, Any]:
"""Update vehicle data using Teslemetry API."""
try:
data = await self.api.vehicle_data(
endpoints=[
VehicleDataEndpoints.CHARGE_STATE,
VehicleDataEndpoints.CLIMATE_STATE,
#VehicleDataEndpoints.CLOSURES_STATE,
VehicleDataEndpoints.DRIVE_STATE,
#VehicleDataEndpoints.GUI_SETTINGS,
VehicleDataEndpoints.LOCATION_DATA,
#VehicleDataEndpoints.VEHICLE_CONFIG,
VehicleDataEndpoints.VEHICLE_STATE,
] #charge_state;climate_state;drive_state;vehicle_state;location_data
endpoints="charge_state;climate_state;drive_state;vehicle_state;location_data"
)
except VehicleOffline:
self.data["state"] = TeslemetryState.OFFLINE
Expand Down
2 changes: 2 additions & 0 deletions custom_components/teslemetry/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ async def async_setup_entry(
class TeslemetryDeviceTrackerEntity(TeslemetryVehicleEntity, TrackerEntity):
"""Base class for Teslemetry Tracker Entities."""

_attr_entity_category = None

def __init__(
self,
vehicle: TeslemetryVehicleData,
Expand Down

0 comments on commit fea8740

Please sign in to comment.