From 2793d5b3b11137aad495896a7777bfd12fcae820 Mon Sep 17 00:00:00 2001 From: GitOldGrumpy Date: Wed, 24 Jan 2024 21:05:17 +0000 Subject: [PATCH 1/6] Lexus Work 1 --- mytoyota/controller.py | 4 +++- mytoyota/models/endpoints/vehicle_guid.py | 2 +- simple_client_example.py | 5 +---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mytoyota/controller.py b/mytoyota/controller.py index df084138..256798d8 100644 --- a/mytoyota/controller.py +++ b/mytoyota/controller.py @@ -236,7 +236,9 @@ async def request_raw( # noqa: PLR0913 "guid": self._uuid, "authorization": f"Bearer {self._token}", "x-channel": "ONEAPP", - "x-brand": "T", + "x-appbrand": "L", + "brand": "L", + "x-brand": "L", "user-agent": "okhttp/4.10.0", }, ) diff --git a/mytoyota/models/endpoints/vehicle_guid.py b/mytoyota/models/endpoints/vehicle_guid.py index 2072fd87..80f06711 100644 --- a/mytoyota/models/endpoints/vehicle_guid.py +++ b/mytoyota/models/endpoints/vehicle_guid.py @@ -390,7 +390,7 @@ class VehicleGuidModel(BaseModel): head_unit: _HeadUnitModel = Field(alias="headUnit") hw_type: Optional[Any] = Field(alias="hwType") # TODO unsure what this returns image: str - imei: str + imei: Optional[str] = None katashiki_code: str = Field(alias="katashikiCode") manufactured_date: date = Field(alias="manufacturedDate") manufactured_code: str = Field(alias="manufacturerCode") diff --git a/simple_client_example.py b/simple_client_example.py index 7797797c..1dd9a538 100644 --- a/simple_client_example.py +++ b/simple_client_example.py @@ -84,7 +84,4 @@ async def get_information(): # Dump all the information collected so far: # pp.pprint(car._dump_all()) - -loop = asyncio.get_event_loop() -loop.run_until_complete(get_information()) -loop.close() +asyncio.run(get_information()) \ No newline at end of file From deb234538f57b4dc79af3601ab3e42b8b2a35659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B6rrle?= Date: Thu, 25 Jan 2024 11:19:24 +0100 Subject: [PATCH 2/6] add brand variable to api requests --- mytoyota/api.py | 70 +++++++++++++++++++++++++------------- mytoyota/client.py | 8 +++-- mytoyota/controller.py | 23 ++++++++++--- mytoyota/models/vehicle.py | 5 ++- simple_client_example.py | 5 +-- 5 files changed, 78 insertions(+), 33 deletions(-) diff --git a/mytoyota/api.py b/mytoyota/api.py index a9dc0ce4..2e692904 100644 --- a/mytoyota/api.py +++ b/mytoyota/api.py @@ -49,17 +49,20 @@ def __init__(self, controller: Controller) -> None: """ self.controller = controller - async def _request_and_parse(self, model, method: str, endpoint: str, **kwargs): + async def _request_and_parse(self, model, method: str, endpoint: str, brand: str, **kwargs): """Parse requests and responses.""" - response = await self.controller.request_json(method=method, endpoint=endpoint, **kwargs) + response = await self.controller.request_json( + method=method, endpoint=endpoint, brand=brand, **kwargs + ) return model(**response) - async def set_vehicle_alias_endpoint(self, alias: str, guid: str, vin: str): + async def set_vehicle_alias_endpoint(self, alias: str, guid: str, vin: str, brand: str): """Set the alias for a vehicle.""" return await self.controller.request_raw( method="PUT", endpoint=VEHICLE_ASSOCIATION_ENDPOINT, vin=vin, + brand=brand, headers={ "datetime": str(int(datetime.now(timezone.utc).timestamp() * 1000)), "x-correlationid": str(uuid4()), @@ -76,34 +79,37 @@ async def set_vehicle_alias_endpoint(self, alias: str, guid: str, vin: str): # method="POST", endpoint="/v2/global/remote/wake" # ) - async def get_vehicles_endpoint(self) -> VehiclesResponseModel: + async def get_vehicles_endpoint(self, brand: str = "Toyota") -> VehiclesResponseModel: """Return list of vehicles registered with provider.""" parsed_response = await self._request_and_parse( - VehiclesResponseModel, "GET", VEHICLE_GUID_ENDPOINT + VehiclesResponseModel, "GET", VEHICLE_GUID_ENDPOINT, brand ) _LOGGER.debug(msg=f"Parsed 'VehiclesResponseModel': {parsed_response}") return parsed_response - async def get_location_endpoint(self, vin: str) -> LocationResponseModel: + async def get_location_endpoint(self, vin: str, brand: str) -> LocationResponseModel: """Get the last known location of your car. Only updates when car is parked. Response includes Lat, Lon position. * If supported. Args: ---- - vin: str: The vehicles VIN + vin: (str): The vehicles VIN + brand (str): The car brand used for the request. Returns: ------- LocationResponseModel: A pydantic model for the location response """ parsed_response = await self._request_and_parse( - LocationResponseModel, "GET", VEHICLE_LOCATION_ENDPOINT, vin=vin + LocationResponseModel, "GET", VEHICLE_LOCATION_ENDPOINT, vin=vin, brand=brand ) _LOGGER.debug(msg=f"Parsed 'LocationResponseModel': {parsed_response}") return parsed_response - async def get_vehicle_health_status_endpoint(self, vin: str) -> VehicleHealthResponseModel: + async def get_vehicle_health_status_endpoint( + self, vin: str, brand: str + ) -> VehicleHealthResponseModel: r"""Get the latest health status. Response includes the quantity of engine oil and any dashboard warning lights. \n @@ -111,30 +117,34 @@ async def get_vehicle_health_status_endpoint(self, vin: str) -> VehicleHealthRes Args: ---- - vin: str: The vehicles VIN + vin: (str): The vehicles VIN + brand (str): The car brand used for the request. Returns: ------- VehicleHealthResponseModel: A pydantic model for the vehicle health response """ parsed_response = await self._request_and_parse( - VehicleHealthResponseModel, "GET", VEHICLE_HEALTH_STATUS_ENDPOINT, vin=vin + VehicleHealthResponseModel, "GET", VEHICLE_HEALTH_STATUS_ENDPOINT, vin=vin, brand=brand ) _LOGGER.debug(msg=f"Parsed 'VehicleHealthResponseModel': {parsed_response}") return parsed_response - async def get_remote_status_endpoint(self, vin: str) -> RemoteStatusResponseModel: + async def get_remote_status_endpoint(self, vin: str, brand: str) -> RemoteStatusResponseModel: """Get information about the vehicle.""" parsed_response = await self._request_and_parse( RemoteStatusResponseModel, "GET", VEHICLE_GLOBAL_REMOTE_STATUS_ENDPOINT, vin=vin, + brand=brand, ) _LOGGER.debug(msg=f"Parsed 'RemoteStatusResponseModel': {parsed_response}") return parsed_response - async def get_vehicle_electric_status_endpoint(self, vin: str) -> ElectricResponseModel: + async def get_vehicle_electric_status_endpoint( + self, vin: str, brand: str + ) -> ElectricResponseModel: r"""Get the latest electric status. Response includes current battery level, EV Range, EV Range with AC, \n @@ -142,7 +152,8 @@ async def get_vehicle_electric_status_endpoint(self, vin: str) -> ElectricRespon Args: ---- - vin: str: The vehicles VIN + vin: (str): The vehicles VIN + brand (str): The car brand used for the request. Returns: ------- @@ -153,30 +164,32 @@ async def get_vehicle_electric_status_endpoint(self, vin: str) -> ElectricRespon "GET", VEHICLE_GLOBAL_REMOTE_ELECTRIC_STATUS_ENDPOINT, vin=vin, + brand=brand, ) _LOGGER.debug(msg=f"Parsed 'ElectricResponseModel': {parsed_response}") return parsed_response - async def get_telemetry_endpoint(self, vin: str) -> TelemetryResponseModel: + async def get_telemetry_endpoint(self, vin: str, brand: str) -> TelemetryResponseModel: """Get the latest telemetry status. Response includes current fuel level, distance to empty and odometer Args: ---- - vin: str: The vehicles VIN + vin: (str): The vehicles VIN + brand (str): The car brand used for the request. Returns: ------- TelemetryResponseModel: A pydantic model for the telemetry response """ parsed_response = await self._request_and_parse( - TelemetryResponseModel, "GET", VEHICLE_TELEMETRY_ENDPOINT, vin=vin + TelemetryResponseModel, "GET", VEHICLE_TELEMETRY_ENDPOINT, vin=vin, brand=brand ) _LOGGER.debug(msg=f"Parsed 'TelemetryResponseModel': {parsed_response}") return parsed_response - async def get_notification_endpoint(self, vin: str) -> NotificationResponseModel: + async def get_notification_endpoint(self, vin: str, brand: str) -> NotificationResponseModel: """Get all available notifications for the vehicle. A notification includes a message, notification date, read flag, date read. @@ -185,7 +198,8 @@ async def get_notification_endpoint(self, vin: str) -> NotificationResponseModel Args: ---- - vin: str: The vehicles VIN + vin: (str): The vehicles VIN + brand (str): The car brand used for the request. Returns: ------- @@ -196,6 +210,7 @@ async def get_notification_endpoint(self, vin: str) -> NotificationResponseModel "GET", VEHICLE_NOTIFICATION_HISTORY_ENDPOINT, vin=vin, + brand=brand, ) _LOGGER.debug(msg=f"Parsed 'NotificationResponseModel': {parsed_response}") return parsed_response @@ -203,6 +218,7 @@ async def get_notification_endpoint(self, vin: str) -> NotificationResponseModel async def get_trips_endpoint( # noqa: PLR0913 self, vin: str, + brand: str, from_date: date, to_date: date, route: bool = False, @@ -219,6 +235,7 @@ async def get_trips_endpoint( # noqa: PLR0913 Args: ---- vin: str: The vehicles VIN + brand: str: The car brand used for the request. from_date: date: From date to include trips, inclusive. Cant be in the future. to_date: date: To date to include trips, inclusive. Cant be in the future. route: bool: If true returns the route of each trip as a list of coordinates. @@ -240,26 +257,33 @@ async def get_trips_endpoint( # noqa: PLR0913 offset=offset, ) parsed_response = await self._request_and_parse( - TripsResponseModel, "GET", endpoint, vin=vin + TripsResponseModel, "GET", endpoint, vin=vin, brand=brand ) _LOGGER.debug(msg=f"Parsed 'TripsResponseModel': {parsed_response}") return parsed_response - async def get_service_history_endpoint(self, vin: str) -> ServiceHistoryResponseModel: + async def get_service_history_endpoint( + self, vin: str, brand: str + ) -> ServiceHistoryResponseModel: """Get the current servic history. Response includes service category, date and dealer. Args: ---- - vin: str: The vehicles VIN + vin: (str): The vehicles VIN + brand (str): The car brand used for the request. Returns: ------- ServicHistoryResponseModel: A pydantic model for the service history response """ parsed_response = await self._request_and_parse( - ServiceHistoryResponseModel, "GET", VEHICLE_SERVICE_HISTORY_ENDPONT, vin=vin + ServiceHistoryResponseModel, + "GET", + VEHICLE_SERVICE_HISTORY_ENDPONT, + vin=vin, + brand=brand, ) _LOGGER.debug(msg=f"Parsed 'ServiceHistoryResponseModel': {parsed_response}") return parsed_response diff --git a/mytoyota/client.py b/mytoyota/client.py index 22c8fdb3..176de3c1 100644 --- a/mytoyota/client.py +++ b/mytoyota/client.py @@ -58,11 +58,13 @@ async def login(self) -> None: _LOGGER.debug("Performing first login") await self._api.controller.login() - async def get_vehicles(self, metric: bool = True) -> Optional[List[Vehicle]]: + async def get_vehicles( + self, metric: bool = True, brand: str = "Toyota" + ) -> Optional[List[Vehicle]]: """Return a list of vehicles.""" _LOGGER.debug("Getting list of vehicles associated with the account") - vehicles = await self._api.get_vehicles_endpoint() + vehicles = await self._api.get_vehicles_endpoint(brand) if vehicles.payload is not None: - return [Vehicle(self._api, v, metric) for v in vehicles.payload] + return [Vehicle(self._api, v, metric, brand) for v in vehicles.payload] return [] diff --git a/mytoyota/controller.py b/mytoyota/controller.py index 256798d8..209b4eab 100644 --- a/mytoyota/controller.py +++ b/mytoyota/controller.py @@ -35,6 +35,19 @@ # This seems to work sometimes but no others. Needs investigation. +def get_brand_headers(headers: Dict[str, Any], brand: str) -> Dict[str, Any]: + """Update the headers, depending on the given car brand.""" + if brand == "Lexus": + headers |= { + "x-appbrand": "L", + "brand": "L", + "x-brand": "L", + } + elif brand == "Toyota": + headers["x-brand"] = "T" + return headers + + class Controller: """Controller class.""" @@ -215,6 +228,7 @@ async def request_raw( # noqa: PLR0913 self, method: str, endpoint: str, + brand: str = "Toyota", vin: Optional[str] = None, body: Optional[Dict[str, Any]] = None, params: Optional[Dict[str, Any]] = None, @@ -236,12 +250,10 @@ async def request_raw( # noqa: PLR0913 "guid": self._uuid, "authorization": f"Bearer {self._token}", "x-channel": "ONEAPP", - "x-appbrand": "L", - "brand": "L", - "x-brand": "L", "user-agent": "okhttp/4.10.0", }, ) + headers = get_brand_headers(headers, brand) # Add vin if passed if vin is not None: headers.update({"vin": vin}) @@ -268,6 +280,7 @@ async def request_json( # noqa: PLR0913 self, method: str, endpoint: str, + brand: str = "Toyota", vin: Optional[str] = None, body: Optional[Dict[str, Any]] = None, params: Optional[Dict[str, Any]] = None, @@ -281,6 +294,8 @@ async def request_json( # noqa: PLR0913 endpoint (str): The endpoint to send the request to. vin (Optional[str], optional): The VIN (Vehicle Identification Number) to include in the request. Defaults to None. + brand (str): The car brand used for the request. + Defaults to Toyota. body (Optional[Dict[str, Any]], optional): The JSON body to include in the request. Defaults to None. params (Optional[Dict[str, Any]], optional): The query parameters to @@ -296,6 +311,6 @@ async def request_json( # noqa: PLR0913 -------- response = await request_json("GET", "/cars", vin="1234567890") """ - response = await self.request_raw(method, endpoint, vin, body, params, headers) + response = await self.request_raw(method, endpoint, brand, vin, body, params, headers) return response.json() diff --git a/mytoyota/models/vehicle.py b/mytoyota/models/vehicle.py index e016dd9b..44f04376 100644 --- a/mytoyota/models/vehicle.py +++ b/mytoyota/models/vehicle.py @@ -30,12 +30,15 @@ class Vehicle: """Vehicle data representation.""" - def __init__(self, api: Api, vehicle_info: VehicleGuidModel, metric: bool = True) -> None: + def __init__( + self, api: Api, vehicle_info: VehicleGuidModel, metric: bool = True, brand: str = "Toyota" + ) -> None: """Initialise the Vehicle data representation.""" self._vehicle_info = vehicle_info self._api = api self._endpoint_data: Dict[str, Any] = {} self._metric = metric + self._brand = brand # Endpoint Name, Function to check if car supports the endpoint, endpoint to call to update api_endpoints = [ diff --git a/simple_client_example.py b/simple_client_example.py index 1dd9a538..3b43e87f 100644 --- a/simple_client_example.py +++ b/simple_client_example.py @@ -47,7 +47,7 @@ async def get_information(): await client.login() print("Retrieving cars...") - cars = await client.get_vehicles(metric=True) + cars = await client.get_vehicles(metric=True, brand="Lexus") for car in cars: await car.update() @@ -84,4 +84,5 @@ async def get_information(): # Dump all the information collected so far: # pp.pprint(car._dump_all()) -asyncio.run(get_information()) \ No newline at end of file + +asyncio.run(get_information()) From e98508b73815e2defbc7a270a49c0ac97a49ae8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B6rrle?= Date: Thu, 25 Jan 2024 11:26:13 +0100 Subject: [PATCH 3/6] Adjust tests --- tests/test_api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index dc2dbe35..8a408d4c 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -31,6 +31,7 @@ # Constants for tests VIN = "Random0815" +BRAND = "Toyota" GUID = "123e4567-e89b-12d3-a456-426614174000" ALIAS = "MyCar" TODAY = date.today() @@ -161,8 +162,10 @@ async def test_api_request_and_parse_endpoints( api = Api(controller) # Act - response = await api._request_and_parse(model, method, endpoint, vin=VIN) + response = await api._request_and_parse(model, method, endpoint, vin=VIN, brand=BRAND) # Assert - controller.request_json.assert_called_once_with(method=method, endpoint=endpoint, vin=VIN) + controller.request_json.assert_called_once_with( + method=method, endpoint=endpoint, vin=VIN, brand=BRAND + ) assert response == model(**response_data), f"Test ID: {test_id}" From e12963dba52ffad25f2a778aabfb1b3730de1fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B6rrle?= Date: Thu, 25 Jan 2024 11:32:33 +0100 Subject: [PATCH 4/6] add brand to api calls in vehicle class --- mytoyota/api.py | 2 +- mytoyota/client.py | 4 +--- mytoyota/controller.py | 8 ++++---- mytoyota/models/vehicle.py | 32 ++++++++++++++++++++++++++------ tests/test_api.py | 2 +- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/mytoyota/api.py b/mytoyota/api.py index 2e692904..d9f1e4c6 100644 --- a/mytoyota/api.py +++ b/mytoyota/api.py @@ -79,7 +79,7 @@ async def set_vehicle_alias_endpoint(self, alias: str, guid: str, vin: str, bran # method="POST", endpoint="/v2/global/remote/wake" # ) - async def get_vehicles_endpoint(self, brand: str = "Toyota") -> VehiclesResponseModel: + async def get_vehicles_endpoint(self, brand: str = "T") -> VehiclesResponseModel: """Return list of vehicles registered with provider.""" parsed_response = await self._request_and_parse( VehiclesResponseModel, "GET", VEHICLE_GUID_ENDPOINT, brand diff --git a/mytoyota/client.py b/mytoyota/client.py index 176de3c1..00037ee1 100644 --- a/mytoyota/client.py +++ b/mytoyota/client.py @@ -58,9 +58,7 @@ async def login(self) -> None: _LOGGER.debug("Performing first login") await self._api.controller.login() - async def get_vehicles( - self, metric: bool = True, brand: str = "Toyota" - ) -> Optional[List[Vehicle]]: + async def get_vehicles(self, metric: bool = True, brand: str = "T") -> Optional[List[Vehicle]]: """Return a list of vehicles.""" _LOGGER.debug("Getting list of vehicles associated with the account") vehicles = await self._api.get_vehicles_endpoint(brand) diff --git a/mytoyota/controller.py b/mytoyota/controller.py index 209b4eab..1b6fe039 100644 --- a/mytoyota/controller.py +++ b/mytoyota/controller.py @@ -37,13 +37,13 @@ def get_brand_headers(headers: Dict[str, Any], brand: str) -> Dict[str, Any]: """Update the headers, depending on the given car brand.""" - if brand == "Lexus": + if brand == "L": headers |= { "x-appbrand": "L", "brand": "L", "x-brand": "L", } - elif brand == "Toyota": + elif brand == "T": headers["x-brand"] = "T" return headers @@ -228,7 +228,7 @@ async def request_raw( # noqa: PLR0913 self, method: str, endpoint: str, - brand: str = "Toyota", + brand: str = "T", vin: Optional[str] = None, body: Optional[Dict[str, Any]] = None, params: Optional[Dict[str, Any]] = None, @@ -280,7 +280,7 @@ async def request_json( # noqa: PLR0913 self, method: str, endpoint: str, - brand: str = "Toyota", + brand: str = "T", vin: Optional[str] = None, body: Optional[Dict[str, Any]] = None, params: Optional[Dict[str, Any]] = None, diff --git a/mytoyota/models/vehicle.py b/mytoyota/models/vehicle.py index 44f04376..7cb38ea2 100644 --- a/mytoyota/models/vehicle.py +++ b/mytoyota/models/vehicle.py @@ -31,7 +31,7 @@ class Vehicle: """Vehicle data representation.""" def __init__( - self, api: Api, vehicle_info: VehicleGuidModel, metric: bool = True, brand: str = "Toyota" + self, api: Api, vehicle_info: VehicleGuidModel, metric: bool = True, brand: str = "T" ) -> None: """Initialise the Vehicle data representation.""" self._vehicle_info = vehicle_info @@ -46,7 +46,9 @@ def __init__( "name": "location", "capable": vehicle_info.extended_capabilities.last_parked_capable or vehicle_info.features.last_parked, - "function": partial(self._api.get_location_endpoint, vin=vehicle_info.vin), + "function": partial( + self._api.get_location_endpoint, vin=vehicle_info.vin, brand=vehicle_info.brand + ), }, { "name": "health_status", @@ -54,6 +56,7 @@ def __init__( "function": partial( self._api.get_vehicle_health_status_endpoint, vin=vehicle_info.vin, + brand=vehicle_info.brand, ), }, { @@ -62,27 +65,44 @@ def __init__( "function": partial( self._api.get_vehicle_electric_status_endpoint, vin=vehicle_info.vin, + brand=vehicle_info.brand, ), }, { "name": "telemetry", "capable": vehicle_info.extended_capabilities.telemetry_capable, - "function": partial(self._api.get_telemetry_endpoint, vin=vehicle_info.vin), + "function": partial( + self._api.get_telemetry_endpoint, + vin=vehicle_info.vin, + brand=vehicle_info.brand, + ), }, { "name": "notifications", "capable": True, # TODO Unsure of the required capability - "function": partial(self._api.get_notification_endpoint, vin=vehicle_info.vin), + "function": partial( + self._api.get_notification_endpoint, + vin=vehicle_info.vin, + brand=vehicle_info.brand, + ), }, { "name": "status", "capable": vehicle_info.extended_capabilities.vehicle_status, - "function": partial(self._api.get_remote_status_endpoint, vin=vehicle_info.vin), + "function": partial( + self._api.get_remote_status_endpoint, + vin=vehicle_info.vin, + brand=vehicle_info.brand, + ), }, { "name": "service_history", "capable": vehicle_info.features.service_history, - "function": partial(self._api.get_service_history_endpoint, vin=vehicle_info.vin), + "function": partial( + self._api.get_service_history_endpoint, + vin=vehicle_info.vin, + brand=vehicle_info.brand, + ), }, ] self._endpoint_collect = [ diff --git a/tests/test_api.py b/tests/test_api.py index 8a408d4c..f68272c9 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -31,7 +31,7 @@ # Constants for tests VIN = "Random0815" -BRAND = "Toyota" +BRAND = "T" GUID = "123e4567-e89b-12d3-a456-426614174000" ALIAS = "MyCar" TODAY = date.today() From 5e87cef4cb6bfcb1f13f2ad31a9a1ce4ba417ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B6rrle?= Date: Thu, 25 Jan 2024 11:34:09 +0100 Subject: [PATCH 5/6] get brand from vehicle info --- mytoyota/client.py | 2 +- mytoyota/models/vehicle.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/mytoyota/client.py b/mytoyota/client.py index 00037ee1..40685575 100644 --- a/mytoyota/client.py +++ b/mytoyota/client.py @@ -63,6 +63,6 @@ async def get_vehicles(self, metric: bool = True, brand: str = "T") -> Optional[ _LOGGER.debug("Getting list of vehicles associated with the account") vehicles = await self._api.get_vehicles_endpoint(brand) if vehicles.payload is not None: - return [Vehicle(self._api, v, metric, brand) for v in vehicles.payload] + return [Vehicle(self._api, v, metric) for v in vehicles.payload] return [] diff --git a/mytoyota/models/vehicle.py b/mytoyota/models/vehicle.py index 7cb38ea2..0cb64812 100644 --- a/mytoyota/models/vehicle.py +++ b/mytoyota/models/vehicle.py @@ -30,15 +30,12 @@ class Vehicle: """Vehicle data representation.""" - def __init__( - self, api: Api, vehicle_info: VehicleGuidModel, metric: bool = True, brand: str = "T" - ) -> None: + def __init__(self, api: Api, vehicle_info: VehicleGuidModel, metric: bool = True) -> None: """Initialise the Vehicle data representation.""" self._vehicle_info = vehicle_info self._api = api self._endpoint_data: Dict[str, Any] = {} self._metric = metric - self._brand = brand # Endpoint Name, Function to check if car supports the endpoint, endpoint to call to update api_endpoints = [ From d7e4b2d907cb4a288a259f39cf15251d63daac55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B6rrle?= Date: Thu, 25 Jan 2024 11:35:20 +0100 Subject: [PATCH 6/6] update brand in clients example --- simple_client_example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple_client_example.py b/simple_client_example.py index 3b43e87f..0ef8d19e 100644 --- a/simple_client_example.py +++ b/simple_client_example.py @@ -47,7 +47,7 @@ async def get_information(): await client.login() print("Retrieving cars...") - cars = await client.get_vehicles(metric=True, brand="Lexus") + cars = await client.get_vehicles(metric=True, brand="L") for car in cars: await car.update()