Skip to content

Commit

Permalink
fix: Remove references to deprecated vehicles endpoint. (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
iancg authored Feb 3, 2024
1 parent 509cf4f commit 5da3f82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
13 changes: 6 additions & 7 deletions teslajsonpy/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,6 @@ async def get_product_list(self) -> list:
"""Get product list from Tesla."""
return (await self.api("PRODUCT_LIST"))["response"]

async def get_vehicles(self) -> list:
"""Get vehicles json from TeslaAPI."""
return (await self.api("VEHICLE_LIST"))["response"]

async def get_site_config(self, energysite_id: int) -> dict:
"""Get site config json from TeslaAPI for a given energysite_id."""
return (await self.api("SITE_CONFIG", path_vars={"site_id": energysite_id}))[
Expand Down Expand Up @@ -718,7 +714,7 @@ async def _get_and_process_site_config(energysite_id: int) -> None:
async with self.__update_lock:
if self._vehicle_list:
cur_time = round(time.time())
# Update the online cars using get_vehicles()
# Update the online cars using get_product_list()
last_update = self._last_attempted_update_time
_LOGGER.debug(
"Get vehicles. Force: %s Time: %s Interval %s",
Expand All @@ -731,8 +727,11 @@ async def _get_and_process_site_config(energysite_id: int) -> None:
or cur_time - last_update >= ONLINE_INTERVAL
and update_vehicles
):
cars = await self.get_vehicles()
for car in cars:
self._product_list = await self.get_product_list()
self._vehicle_list = [
cars for cars in self._product_list if "vehicle_id" in cars
]
for car in self._vehicle_list:
self.set_id_vin(car_id=car["id"], vin=car["vin"])
self.set_vehicle_id_vin(
vehicle_id=car["vehicle_id"], vin=car["vin"]
Expand Down
5 changes: 0 additions & 5 deletions teslajsonpy/endpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
"URI": "api/1/products",
"AUTH": true
},
"VEHICLE_LIST": {
"TYPE": "GET",
"URI": "api/1/vehicles",
"AUTH": true
},
"VEHICLE_ORDER_LIST": {
"TYPE": "GET",
"URI": "api/1/users/orders",
Expand Down

0 comments on commit 5da3f82

Please sign in to comment.