Skip to content

Commit

Permalink
Moved all calls to the Vehicle class.
Browse files Browse the repository at this point in the history
Trips, Statistics & HVAC still missing.
All "getter" functions are synchronous.
All "setter" functions are asynchronous. HOWEVER none of them work, something is missing.
Re-worked they way endpoints are retrieved and added capability checking.
  • Loading branch information
GitOldGrumpy authored and GitOldGrumpy committed Nov 18, 2023
1 parent 6e7051f commit 6d25366
Show file tree
Hide file tree
Showing 6 changed files with 456 additions and 606 deletions.
25 changes: 22 additions & 3 deletions mytoyota/api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Toyota Connected Services API"""
from typing import Any
from datetime import datetime
from uuid import uuid4

from .const import BASE_URL
from .controller import Controller
Expand All @@ -19,10 +21,27 @@ def uuid(self) -> str | None:
return self.controller.uuid

async def set_vehicle_alias_endpoint(
self, new_alias: str, vehicle_id: int
) -> dict[str, Any] | None:
self,
alias: str,
guid: str,
vin: str
):
# It does seem to support it. Need to find the endpoint.
raise NotImplemented("Endpoint not found")
t = "b5ee3984-2f04-474b-b71c-6b3819155928"
resp = await self.controller.request(
method="PUT",
base_url=BASE_URL,
endpoint="/v1/vehicle-association/vehicle",
headers={"datetime": str(int(datetime.utcnow().timestamp())),
"x-correlationid": str(uuid4()),
"Content-Type": "application/json"
},
body={"guid": guid,
"vin": vin,
"nickName": alias}
)

return resp

async def get_vehicles_endpoint(self) -> list[dict[str, Any] | None] | None:
"""Retrieves list of cars you have registered with MyT"""
Expand Down
Loading

0 comments on commit 6d25366

Please sign in to comment.