-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New API Endpoints: Basics working. Thoughts & Help needed #242
Conversation
No statistics. Possible but needs changing. Will cause exceptions. No trips. Possible but needs changing. Will cause exceptions. No "setting" of data. Is possible need to work out endpoints. No HVAC. Is possible need to work out endpoint. Tests will fail. Doesn't deal with regresh token. Depracated endpoints still there but fail. May other things are still missing.
Hello @GitOldGrumpy, thank you very much for your efforts! |
I started implementing the proposal today and need to make a change. If I implement it as I suggested you get a strange Vehicle class that has a mixture of synchronous and asynchronous calls(as you never know if you are going to have to update an endpoint). This makes the class complicated for the user to call so I will make all calls synchronous and add a single asynchronous update function. |
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.
I've done what I suggested and pushed for people to take a look. Still endpoints missing(they are there just need to do the work) but am currently stuck on "setting" values am missing something in the headers which upsets the endpoint. Needs more investigation. |
Can retrieve all notifications. Seems no way to limit how little/many are returned. Added flag for only unread notifications.
Forget it. I found out that ➜ python simple_client_test.py
Logging in...
Retrieving cars...
Alias: Corolla
Mileage : 18828.1685
Fuel : 12
Battery : None
Latitude : 49.xxxx
Notifications:
2023-11-08 09:58:38.687000+00:00 : 2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.
2023-11-07 13:37:40.899000+00:00 : 2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.
2023-11-07 13:22:25.985000+00:00 : 2019 Corolla HB/TS Fahrertür offen.
2023-11-07 13:13:34.968000+00:00 : 2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.
2023-11-07 12:24:16.203000+00:00 : 2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details. |
Ok. Hopefully I've updated that correctly. You'll have to forgive me with these things hacking away at python I'm use too, doing it all properly not so much. I assume its possible to run all the checks locally before I push, could someone point me at the documentation on how to do this. |
I don't know how much you know about poetry? My workflow is usually as follows. Install poetry with your default Python3 Version: curl -sSL https://install.python-poetry.org | python3 - Afterwards you can generate a Python 3.11 venv manually and can use poetry: Afterwards you can generate a Python 3.11 venv manually and can use poetry with it: python3.11 -m venv /path/to/new/virtual/environment
source /path/to/new/virtual/environment/bin/activate
cd /path/to/your/local/mytoyota/repository
poetry install Pre-commit itself is already installed into the venv via the dev dependencies in this way pre-commit install
pre-commit run --all-files pre-commit now also runs automatically for every changed file with every commit. |
By the wasy: The Click me{
"alerts": [],
"asiCode": "FC",
"brand": "T",
"capabilities": [
{
"name": "alexaStandardCapable",
"description": None,
"value": True,
"translation": {"english": None, "french": None, "spanish": None},
"display": True,
"displayName": None,
},
{
"name": "androidAutoCapable",
"description": None,
"value": True,
"translation": {"english": None, "french": None, "spanish": None},
"display": True,
"displayName": None,
},
{
"name": "carplayStandardCapable",
"description": None,
"value": True,
"translation": {"english": None, "french": None, "spanish": None},
"display": True,
"displayName": None,
},
],
"carlineName": "Corolla HB/TS",
"color": "Emotional Red 2",
"commercialRental": False,
"contractId": "xxxMyContractIdxxx>",
"ctsLinks": {
"name": "Connected Services Support",
"link": "https://qa.toyotaaudioandconnectedservicessupport.com/toyota/home?source=OneApp&vin=xxxMyVinxxx>",
"imageUrl": None,
"body": None,
"buttonText": None,
},
"dataConsent": {
"serviceConnect": "False",
"can300": "False",
"dealerContact": "False",
"ubi": "false",
},
"dateOfFirstUse": None,
"dcm": {
"dcmModelYear": "19",
"dcmDestination": "10",
"countryCode": None,
"dcmSupplier": "65",
"dcmSupplierName": "Continental",
"dcmGrade": "1",
"euiccid": "xxxMyeuiccidxxx>",
"hardwareType": None,
"vehicleUnitTerminalNumber": None,
},
"dcmActive": False,
"dcms": None,
"displayModelDescription": "2019 Toyota Corolla HB/TS - NG '19",
"displaySubscriptions": [
{"productName": "STANDARD SERVICES", "displayStatus": "Expires On OCT 23, 2033"}
],
"electricalPlatformCode": "15",
"emergencyContact": None,
"extendedCapabilities": {
"remoteEngineStartStop": False,
"remoteEConnectCapable": False,
"doorLockUnlockCapable": False,
"frontDriverDoorLockStatus": True,
"frontPassengerDoorLockStatus": True,
"rearDriverDoorLockStatus": True,
"rearPassengerDoorLockStatus": True,
"frontDriverDoorOpenStatus": True,
"frontPassengerDoorOpenStatus": True,
"rearDriverDoorOpenStatus": True,
"rearPassengerDoorOpenStatus": True,
"frontDriverDoorWindowStatus": True,
"frontPassengerDoorWindowStatus": True,
"rearDriverDoorWindowStatus": True,
"rearPassengerDoorWindowStatus": True,
"rearHatchRearWindow": False,
"moonroof": False,
"powerWindowsCapable": False,
"hazardCapable": False,
"hornCapable": False,
"lightsCapable": False,
"climateCapable": False,
"climateTemperatureControlFull": False,
"climateTemperatureControlLimited": False,
"frontDriverSeatHeater": False,
"frontPassengerSeatHeater": False,
"rearDriverSeatHeater": False,
"rearPassengerSeatHeater": False,
"frontDriverSeatVentilation": False,
"frontPassengerSeatVentilation": False,
"rearDriverSeatVentilation": False,
"rearPassengerSeatVentilation": False,
"steeringHeater": False,
"mirrorHeater": False,
"frontDefogger": False,
"rearDefogger": False,
"vehicleFinder": False,
"guestDriver": False,
"buzzerCapable": False,
"trunkLockUnlockCapable": False,
"evChargeStationsCapable": False,
"fcvStationsCapable": False,
"lastParkedCapable": False,
"acScheduling": False,
"chargeManagement": False,
"nextCharge": False,
"weeklyCharge": False,
"powerTailgateCapable": False,
"batteryStatus": False,
"evBattery": False,
"drivePulse": False,
"electricPulse": False,
"hydrogenPulse": False,
"hybridPulse": True,
"emergencyAssist": False,
"bumpCollisions": False,
"fuelLevelAvailable": True,
"fuelRangeAvailable": True,
"equippedWithAlarm": False,
"manualRearWindows": False,
"lightStatus": True,
"bonnetStatus": True,
"sunroof": False,
"smartKeyStatus": True,
"ecare": False,
"tryAndPlay": False,
"dashboardWarningLights": False,
"weHybridCapable": False,
"enhancedSecuritySystemCapable": False,
"vehicleStatus": True,
"stellantisVehicleStatusCapable": False,
"stellantisClimateCapable": False,
"vehicleDiagnosticCapable": True,
"telemetryCapable": True,
"econnectVehicleStatusCapable": False,
"econnectClimateCapable": False,
},
"externalSubscriptions": None,
"familySharing": False,
"faqUrl": "http://toyota.com/FAQ",
"features": {
"achPayment": 0,
"addServiceRecord": 0,
"autoDrive": 0,
"cerence": 0,
"chargingStation": 0,
"climateStartEngine": 0,
"collisionAssistance": 0,
"connectedCard": 0,
"connectedInsurance": 0,
"connectedSupport": 0,
"crashNotification": 0,
"criticalAlert": 0,
"dashboardLights": 0,
"dealerAppointment": 1,
"digitalKey": 0,
"doorLockCapable": 0,
"drivePulse": 0,
"driverCompanion": 0,
"driverScore": 0,
"dtcAccess": 0,
"dynamicNavi": 0,
"ecoHistory": 0,
"ecoRanking": 0,
"electricPulse": 0,
"emergencyAssist": 0,
"enhancedSecuritySystem": 0,
"evChargeStation": 0,
"evRemoteServices": 0,
"evVehicleStatus": 0,
"financialServices": 0,
"flexRental": 0,
"h2FuelStation": 0,
"homeCharge": 0,
"howToVideos": 0,
"hybridPulse": 1,
"hydrogenPulse": 0,
"importantMessage": 0,
"insurance": 0,
"lastParked": 1,
"lcfs": 0,
"linkedAccounts": 0,
"maintenanceTimeline": 0,
"marketingCard": 0,
"marketingConsent": 0,
"masterConsentEditable": 0,
"myDestination": 0,
"ownersManual": 0,
"paidProduct": 0,
"parkedVehicleLocator": 0,
"parking": 0,
"parkingNotes": 0,
"personalizedSettings": 0,
"privacy": 1,
"recentTrip": 0,
"remoteDtc": 0,
"remoteParking": 0,
"remoteService": 0,
"roadsideAssistance": 0,
"safetyRecall": 0,
"scheduleMaintenance": 0,
"serviceHistory": 1,
"shopGenuineParts": 0,
"smartCharging": 0,
"ssaDownload": 0,
"sxmRadio": 0,
"telemetry": 1,
"tff": 0,
"tirePressure": 0,
"v1g": 0,
"vaSetting": 0,
"vehicleDiagnostic": 1,
"vehicleHealthReport": 0,
"vehicleSpecifications": 0,
"vehicleStatus": 1,
"weHybrid": 0,
"wifi": 0,
"xcapp": 0,
},
"fleetInd": None,
"fuelType": "B",
"generation": "17CYPLUS",
"headUnit": {
"mobilePlatformCode": None,
"huDescription": None,
"huGeneration": None,
"huVersion": None,
"multimediaType": None,
},
"hwType": None,
"image": "https://dj3z27z47basa.cloudfront.net/a2fcaccc-8307-41d8-b1fe-ee4833fb9cde",
"katashikiCode": "xxxMyKatashikiCodexxx>",
"manufacturedDate": "2020-10-26",
"manufacturerCode": "TOY",
"modelCode": "CR",
"modelDescription": "Corolla HB/TS - NG '19",
"modelName": "Corolla HB/TS - NG '19",
"modelYear": "2019",
"nickName": "Corolla",
"nonCvtVehicle": False,
"oldImei": None,
"owner": True,
"personalizedSettings": {
"name": None,
"link": None,
"imageUrl": None,
"body": None,
"buttonText": None,
},
"preferred": 1,
"primarySubscriber": True,
"region": "EU",
"registrationNumber": None,
"remoteDisplay": "9",
"remoteServiceCapabilities": {
"guestDriverCapable": False,
"vehicleFinderCapable": False,
"estartStopCapable": False,
"estartEnabled": False,
"estopEnabled": False,
"acsettingEnabled": False,
"hazardCapable": False,
"dlockUnlockCapable": False,
"headLightCapable": False,
"trunkCapable": False,
"powerWindowCapable": False,
"ventilatorCapable": False,
"steeringWheelHeaterCapable": False,
"allowHvacOverrideCapable": False,
"moonRoofCapable": False,
},
"remoteServicesExceptions": [],
"remoteSubscriptionExists": False,
"remoteSubscriptionStatus": "INACTIVE",
"remoteUser": True,
"remoteUserGuid": "",
"serviceConnectStatus": None,
"services": [],
"shopGenuinePartsUrl": "https://parts.toyota.com/accessories/Toyota_2019_Corolla.html?partner=ONEAPP2019Corolla",
"status": "ACTIVE",
"stockPicReference": "https://dj3z27z47basa.cloudfront.net/a2fcaccc-8307-41d8-b1fe-ee4833fb9cde",
"subscriberGuid": "xxxMySubscriberGuidxxx>",
"subscriptionExpirationStatus": False,
"subscriptionStatus": "SUBSCRIBED",
"subscriptions": [
{
"subscriptionID": "xxxMySubscriptionIdxxx>",
"productName": "STANDARD SERVICES",
"productDescription": "Standard Services",
"displayProductName": "STANDARD SERVICES",
"subscriptionEndDate": "2033-10-23",
"subscriptionNextBillingDate": None,
"subscriptionStartDate": "2023-10-23",
"status": "ACTIVE",
"type": "Trial",
"subscriptionRemainingDays": 3626,
"subscriptionRemainingTerm": None,
"productCode": "PROD_STANDARDSERVICES",
"productLine": "PROD_STANDARDSERVICES",
"productType": None,
"term": 120,
"termUnit": "MTH",
"goodwillIssuedFor": None,
"renewable": False,
"displayTerm": "Expires On OCT 23, 2033",
"subscriptionTerm": "YRLY",
"autoRenew": False,
"futureCancel": False,
"consolidatedProductIds": [],
"consolidatedGoodwillIds": [],
"components": None,
"category": "STANDALONE",
}
],
"suffixCode": None,
"svlStatus": False,
"tffLinks": {
"name": None,
"link": None,
"imageUrl": None,
"body": None,
"buttonText": None,
},
"transmissionType": "A",
"vehicleCapabilities": [],
"vehicleDataConsents": None,
}
|
@CM000n thanks for that. It would be interesting if you could run As you noticed the output is not yet censored so you might want to check that. I will look at re-using the orginal As for poetry I'd never heard of it until I started looking at this project. I will have to take a look and come up to speed. |
Hi @GitOldGrumpy. A Click me{
"vehicle_info": {
"registrationNumber": None,
"vin": "xxxx",
"modelYear": "2019",
"modelName": "Corolla HB/TS - NG '19",
"modelDescription": "Corolla HB/TS - NG '19",
"modelCode": "CR",
"region": "EU",
"status": "ACTIVE",
"generation": "17CYPLUS",
"image": "https://dj3z27z47basa.cloudfront.net/a2fcaccc-8307-41d8-b1fe-ee4833fb9cde",
"nickName": "Corolla",
"brand": "T",
"hwType": None,
"asiCode": "FC",
"subscriptionStatus": "SUBSCRIBED",
"primarySubscriber": True,
"remoteUser": True,
"evVehicle": False,
"remoteSubscriptionStatus": "INACTIVE",
"remoteUserGuid": "",
"subscriberGuid": "xxxx",
"remoteDisplay": "9",
"emergencyContact": None,
"remoteServiceCapabilities": {
"powerWindowCapable": False,
"ventilatorCapable": False,
"moonRoofCapable": False,
"steeringWheelHeaterCapable": False,
"allowHvacOverrideCapable": False,
"estartStopCapable": False,
"estartEnabled": False,
"hazardCapable": False,
"dlockUnlockCapable": False,
"estopEnabled": False,
"acsettingEnabled": False,
"guestDriverCapable": False,
"vehicleFinderCapable": False,
"headLightCapable": False,
"trunkCapable": False,
},
"nonCvtVehicle": False,
"remoteServicesExceptions": [],
"extendedCapabilities": {
"remoteEngineStartStop": False,
"remoteEConnectCapable": False,
"doorLockUnlockCapable": False,
"frontDriverDoorLockStatus": True,
"frontPassengerDoorLockStatus": True,
"rearDriverDoorLockStatus": True,
"rearPassengerDoorLockStatus": True,
"frontDriverDoorOpenStatus": True,
"frontPassengerDoorOpenStatus": True,
"rearDriverDoorOpenStatus": True,
"rearPassengerDoorOpenStatus": True,
"frontDriverDoorWindowStatus": True,
"frontPassengerDoorWindowStatus": True,
"rearDriverDoorWindowStatus": True,
"rearPassengerDoorWindowStatus": True,
"rearHatchRearWindow": False,
"moonroof": False,
"powerWindowsCapable": False,
"hazardCapable": False,
"hornCapable": False,
"lightsCapable": False,
"climateCapable": False,
"climateTemperatureControlFull": False,
"climateTemperatureControlLimited": False,
"frontDriverSeatHeater": False,
"frontPassengerSeatHeater": False,
"rearDriverSeatHeater": False,
"rearPassengerSeatHeater": False,
"frontDriverSeatVentilation": False,
"frontPassengerSeatVentilation": False,
"rearDriverSeatVentilation": False,
"rearPassengerSeatVentilation": False,
"steeringHeater": False,
"mirrorHeater": False,
"frontDefogger": False,
"rearDefogger": False,
"vehicleFinder": False,
"guestDriver": False,
"buzzerCapable": False,
"trunkLockUnlockCapable": False,
"evChargeStationsCapable": False,
"fcvStationsCapable": False,
"lastParkedCapable": False,
"acScheduling": False,
"chargeManagement": False,
"nextCharge": False,
"weeklyCharge": False,
"powerTailgateCapable": False,
"batteryStatus": False,
"evBattery": False,
"drivePulse": False,
"electricPulse": False,
"hydrogenPulse": False,
"hybridPulse": True,
"emergencyAssist": False,
"bumpCollisions": False,
"fuelLevelAvailable": True,
"fuelRangeAvailable": True,
"equippedWithAlarm": False,
"manualRearWindows": False,
"lightStatus": True,
"bonnetStatus": True,
"sunroof": False,
"smartKeyStatus": True,
"ecare": False,
"tryAndPlay": False,
"dashboardWarningLights": False,
"weHybridCapable": False,
"enhancedSecuritySystemCapable": False,
"vehicleStatus": True,
"stellantisVehicleStatusCapable": False,
"stellantisClimateCapable": False,
"vehicleDiagnosticCapable": True,
"telemetryCapable": True,
"econnectClimateCapable": False,
"econnectVehicleStatusCapable": False,
},
"electricalPlatformCode": "15",
"personalizedSettings": {
"name": None,
"link": None,
"imageUrl": None,
"body": None,
"buttonText": None,
},
"fuelType": "B",
"fleetInd": None,
"svlStatus": False,
"displayModelDescription": "2019 Toyota Corolla HB/TS - NG '19",
"manufacturerCode": "TOY",
"suffixCode": None,
"imei": "xxxx",
"color": "Emotional Red 2",
"vehicleDataConsents": None,
"dataConsent": {
"serviceConnect": "False",
"can300": "False",
"dealerContact": "False",
"ubi": "false",
},
"vehicleCapabilities": [],
"capabilities": [
{
"name": "alexaStandardCapable",
"description": None,
"value": True,
"translation": {"english": None, "french": None, "spanish": None},
"display": True,
"displayName": None,
},
{
"name": "androidAutoCapable",
"description": None,
"value": True,
"translation": {"english": None, "french": None, "spanish": None},
"display": True,
"displayName": None,
},
{
"name": "carplayStandardCapable",
"description": None,
"value": True,
"translation": {"english": None, "french": None, "spanish": None},
"display": True,
"displayName": None,
},
],
"subscriptions": [
{
"subscriptionID": "xxxx",
"productName": "STANDARD SERVICES",
"productDescription": "Standard Services",
"displayProductName": "STANDARD SERVICES",
"subscriptionEndDate": "2033-10-23",
"subscriptionNextBillingDate": None,
"subscriptionStartDate": "2023-10-23",
"status": "ACTIVE",
"type": "Trial",
"subscriptionRemainingDays": 3626,
"subscriptionRemainingTerm": None,
"productCode": "PROD_STANDARDSERVICES",
"productLine": "PROD_STANDARDSERVICES",
"productType": None,
"term": 120,
"termUnit": "MTH",
"goodwillIssuedFor": None,
"renewable": False,
"displayTerm": "Expires On OCT 23, 2033",
"subscriptionTerm": "YRLY",
"autoRenew": False,
"futureCancel": False,
"consolidatedProductIds": [],
"consolidatedGoodwillIds": [],
"components": None,
"category": "STANDALONE",
}
],
"services": [],
"displaySubscriptions": [
{
"productName": "STANDARD SERVICES",
"displayStatus": "Expires On OCT 23, 2033",
}
],
"alerts": [],
"features": {
"achPayment": 0,
"addServiceRecord": 0,
"autoDrive": 0,
"cerence": 0,
"chargingStation": 0,
"climateStartEngine": 0,
"collisionAssistance": 0,
"connectedCard": 0,
"connectedInsurance": 0,
"connectedSupport": 0,
"crashNotification": 0,
"criticalAlert": 0,
"dashboardLights": 0,
"dealerAppointment": 1,
"digitalKey": 0,
"doorLockCapable": 0,
"drivePulse": 0,
"driverCompanion": 0,
"driverScore": 0,
"dtcAccess": 0,
"dynamicNavi": 0,
"ecoHistory": 0,
"ecoRanking": 0,
"electricPulse": 0,
"emergencyAssist": 0,
"enhancedSecuritySystem": 0,
"evChargeStation": 0,
"evRemoteServices": 0,
"evVehicleStatus": 0,
"financialServices": 0,
"flexRental": 0,
"h2FuelStation": 0,
"homeCharge": 0,
"howToVideos": 0,
"hybridPulse": 1,
"hydrogenPulse": 0,
"importantMessage": 0,
"insurance": 0,
"lastParked": 1,
"lcfs": 0,
"linkedAccounts": 0,
"maintenanceTimeline": 0,
"marketingCard": 0,
"marketingConsent": 0,
"masterConsentEditable": 0,
"myDestination": 0,
"ownersManual": 0,
"paidProduct": 0,
"parkedVehicleLocator": 0,
"parking": 0,
"parkingNotes": 0,
"personalizedSettings": 0,
"privacy": 1,
"recentTrip": 0,
"remoteDtc": 0,
"remoteParking": 0,
"remoteService": 0,
"roadsideAssistance": 0,
"safetyRecall": 0,
"scheduleMaintenance": 0,
"serviceHistory": 1,
"shopGenuineParts": 0,
"smartCharging": 0,
"ssaDownload": 0,
"sxmRadio": 0,
"telemetry": 1,
"tff": 0,
"tirePressure": 0,
"v1g": 0,
"vaSetting": 0,
"vehicleDiagnostic": 1,
"vehicleHealthReport": 0,
"vehicleSpecifications": 0,
"vehicleStatus": 1,
"weHybrid": 0,
"wifi": 0,
"xcapp": 0,
},
"subscriptionExpirationStatus": False,
"faqUrl": "http://toyota.com/FAQ",
"shopGenuinePartsUrl": "https://parts.toyota.com/accessories/Toyota_2019_Corolla.html?partner=ONEAPP2019Corolla",
"familySharing": False,
"ctsLinks": {
"name": "Connected Services Support",
"link": "https://qa.toyotaaudioandconnectedservicessupport.com/toyota/home?source=OneApp&vin=xxxx",
"imageUrl": None,
"body": None,
"buttonText": None,
},
"tffLinks": {
"name": None,
"link": None,
"imageUrl": None,
"body": None,
"buttonText": None,
},
"headUnit": {
"mobilePlatformCode": None,
"huDescription": None,
"huGeneration": None,
"huVersion": None,
"multimediaType": None,
},
"katashikiCode": "xxxx",
"oldImei": None,
"stockPicReference": "https://dj3z27z47basa.cloudfront.net/a2fcaccc-8307-41d8-b1fe-ee4833fb9cde",
"transmissionType": "A",
"dateOfFirstUse": None,
"dcm": {
"dcmModelYear": "19",
"dcmDestination": "10",
"countryCode": None,
"dcmSupplier": "65",
"dcmSupplierName": "Continental",
"dcmGrade": "1",
"euiccid": "xxxx",
"hardwareType": None,
"vehicleUnitTerminalNumber": None,
},
"dcms": None,
"manufacturedDate": "2020-10-26",
"contractId": "xxxx",
"carlineName": "Corolla HB/TS",
"externalSubscriptions": None,
"serviceConnectStatus": None,
"owner": True,
"remoteSubscriptionExists": False,
"dcmActive": False,
"commercialRental": False,
"preferred": 1,
},
"location": {
"vin": "xxx",
"lastTimestamp": "2023-11-19T18:30:06Z",
"vehicleLocation": {
"displayName": "Last Parked",
"latitude": 49.0000,
"longitude": 8.0000,
"locationAcquisitionDatetime": "2023-11-19T18:30:06Z",
},
},
"status": {
"quantityOfEngOilIcon": [],
"warning": [],
"vin": "xxxx",
"wnglastUpdTime": "2023-11-20T11:31:12.229Z",
},
"telemetry": {
"fuelType": "B",
"odometer": {"value": 30301, "unit": "km"},
"fuelLevel": 12,
"distanceToEmpty": {"value": 82, "unit": "km"},
"timestamp": "2023-11-19T18:30:06Z",
},
"notifications": [
{
"messageId": "654b5bce89146fe1dcde1c4f",
"vin": "xxxx",
"notificationDate": "2023-11-08T09:58:38.687Z",
"isRead": True,
"readTimestamp": "2023-11-09T07:56:20.011Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "654a3da42b1dfee3530570dc",
"vin": "xxxx",
"notificationDate": "2023-11-07T13:37:40.899Z",
"isRead": True,
"readTimestamp": "2023-11-09T07:56:20.011Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "654a3a116992523ebe9a9594",
"vin": "xxxx",
"notificationDate": "2023-11-07T13:22:25.985Z",
"isRead": True,
"readTimestamp": "2023-11-09T07:56:20.011Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS Fahrertür offen.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "654a37fee4770b7ca1b54704",
"vin": "xxxx",
"notificationDate": "2023-11-07T13:13:34.968Z",
"isRead": True,
"readTimestamp": "2023-11-09T07:56:20.011Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "654a2c7005dbda98a304e580",
"vin": "xxxx",
"notificationDate": "2023-11-07T12:24:16.203Z",
"isRead": True,
"readTimestamp": "2023-11-09T07:56:20.011Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "65492ec33f510e170fe5146d",
"vin": "xxxx",
"notificationDate": "2023-11-06T18:21:55.165Z",
"isRead": True,
"readTimestamp": "2023-11-09T07:56:20.011Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "6547ce408ad4f16916836695",
"vin": "xxxx",
"notificationDate": "2023-11-05T17:17:52.406Z",
"isRead": True,
"readTimestamp": "2023-11-06T05:20:47.985Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "6547a1fbfc25822d4c52c47c",
"vin": "xxxx",
"notificationDate": "2023-11-05T14:08:59.748Z",
"isRead": True,
"readTimestamp": "2023-11-06T05:20:47.985Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "65451782581159f1eddc2b31",
"vin": "xxxx",
"notificationDate": "2023-11-03T15:53:38.575Z",
"isRead": True,
"readTimestamp": "2023-11-06T05:20:47.985Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS Hintere Tür auf der Fahrerseite offen.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "6540e84142e4d41d6443222f",
"vin": "xxxx",
"notificationDate": "2023-10-31T11:42:57.690Z",
"isRead": True,
"readTimestamp": "2023-10-31T17:04:37.990Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "6540dd4d8ff01b76f1875e14",
"vin": "xxxx",
"notificationDate": "2023-10-31T10:56:13.484Z",
"isRead": True,
"readTimestamp": "2023-10-31T11:11:20.049Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "653fb6a3d3feeb0008e44f12",
"vin": "xxxx",
"notificationDate": "2023-10-30T13:58:59.004Z",
"isRead": True,
"readTimestamp": "2023-10-31T11:11:20.049Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "653e8ee2a7a3a90008856e61",
"vin": "xxxx",
"notificationDate": "2023-10-29T16:57:06.311Z",
"isRead": True,
"readTimestamp": "2023-10-31T11:11:20.049Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "653cfc040a144c0008bba0ef",
"vin": "xxxx",
"notificationDate": "2023-10-28T12:18:12.849Z",
"isRead": True,
"readTimestamp": "2023-10-31T11:11:20.049Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "653ccfcc2e44c10008df8985",
"vin": "xxxx",
"notificationDate": "2023-10-28T09:09:32.825Z",
"isRead": True,
"readTimestamp": "2023-10-28T09:50:13.749Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "653cc7e2a8a7cb0008df88ba",
"vin": "xxxx",
"notificationDate": "2023-10-28T08:35:46.870Z",
"isRead": True,
"readTimestamp": "2023-10-28T09:50:13.749Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS Hintere Tür auf der Fahrerseite offen.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "653cc2a2a8a7cb0008df86f2",
"vin": "xxxx",
"notificationDate": "2023-10-28T08:13:22.199Z",
"isRead": True,
"readTimestamp": "2023-10-28T09:50:13.749Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS Hintere Tür auf der Fahrerseite offen.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "653a3478a573a50008a84dea",
"vin": "xxxx",
"notificationDate": "2023-10-26T09:42:16.514Z",
"isRead": True,
"readTimestamp": "2023-10-28T09:50:13.749Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "653a2d76a573a50008a84c04",
"vin": "xxxx",
"notificationDate": "2023-10-26T09:12:22.223Z",
"isRead": True,
"readTimestamp": "2023-10-28T09:50:13.749Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "653690bc7724c70007d2a672",
"vin": "xxxx",
"notificationDate": "2023-10-23T15:26:52.381Z",
"isRead": True,
"readTimestamp": "2023-10-28T09:50:13.749Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "65368896e25ecd00088ad3ed",
"vin": "xxxx",
"notificationDate": "2023-10-23T14:52:06.679Z",
"isRead": True,
"readTimestamp": "2023-10-28T09:50:13.749Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
{
"messageId": "653637c8d323d2000817abac",
"vin": "xxxx",
"notificationDate": "2023-10-23T09:07:20.076Z",
"isRead": True,
"readTimestamp": "2023-10-28T09:50:13.749Z",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"message": "2019 Corolla HB/TS mehrere Türen entriegelt, bitte prüfen Sie die App für weitere Details.",
"status": 0,
"type": "alert",
"category": "VehicleStatusAlert",
"displayCategory": "Vehicle Alerts",
},
],
}
|
Awesome work, and some good points. My vision for this lib is that it is wrapper for the API and returns simple dataclasses where we don't process data in any way, as this most be the users problem. This was not possible with old API. It seems that with new APP and API, this will be possible, and you (and @CM000n) have done a lot of work towards making that a reality. This will also make it easier to create unit tests and make sure that it keeps working in the future. Regarding calling endpoints, we should limit the number of calls the API needs to do get all the data. We don't want to overload their servers, and possibly get to much attention from them 😉 When we fetch data we should extract as much info we can, as to not waste API calls, if this makes sense. I don't have much time at the moment, and I don't have a car that supports much, but I will help review and find solutions to get this over the line. @CM000n If this it is possible, should this be split into multiple PR to make it easier to review? |
Perhaps a general question for you two @DurgNomis-drol & @GitOldGrumpy . What is your opinion on this? Maybe we should refactor this as well, if we are already working on a new big bang version of the mytoyota lib which will probably bring some braking changes? |
@CM000n I'm not opposed to anything and that looks like it would automatically parse the JSON and check for correctness. A copule of quick questions(I can have a proper look later):
EDIT: Do you mean just for modelling the endpoint data or for the client API's? For example the "Vehicle" class is a combination of several endpoints? I will take a further look at the documentation later. |
@CM000n Out of interest does the application show the status of the locks your car supports? I can see in the notifications you get warnings if there open, but cant see an obvious endpoint it uses to get a list of them. |
Ok, so it works with normal default values, good to know. The question here is more about what you prefer to do if the response lacks of it. If missing in the response set it to None, or assume that is not preferred and set it to False. |
As we have no official API documentation, it is also difficult to make assumptions about default values. The only thing we can say for sure in this case is that we do not receive a value for |
Hi All, I'd like to help with the testing. |
Thanks, this worked. Didn't decode "payload.1.preferred" as missing field :) Checked output and everything looks ok except it shows "miles" rather than "km" for all relevant fields (fuel_range, odo etc.) |
As a quick test you can use the included python -m venv mytoyota
source mytoyota/bin/activate
python -m pip install "mytoyota @ git+https://github.com/DurgNomis-drol/mytoyota@refs/pull/242/head"
curl -LO https://raw.githubusercontent.com/GitOldGrumpy/mytoyota/master/simple_client_example.py
# Create a credentials.json file with {"username":"your@mail.tld","password":"yourpassword"}
python simple_client_example.py |
@HuffYk: You have to run the |
Thanks skgsergio for your help. |
Just tested with my account, got the following error (PHEV):
|
What car and motor type do you own @clews ? |
Exactly - Prius 2023 PHEV |
This is kind of what I expected the more people use it the more we need to refine the pydantic models. @clews was the car parked up at the time? Or does your car not support scheduled charging. Anyway the fix is to change line electric.py:27 to the following.
|
@GitOldGrumpy the car was parked at this time, it supports charging schedule but the schedule is empty (even unused) right now (don't have a fixed charging installation yet). Setting the default worked, got all data that the App is showing me the last trips. Will do a test in the next 2 days while the car is charging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job you guys have done 🚀
I can see you have add a lot of extra things. Would this be possible to add later instead? It is nearly impossible to review probably because of so much code. Can we keep this PR to only the changes that is need to get it working?. This will also make it much faster for me, and the others to get it merged 😄
Hi @DurgNomis-drol, thx for reviewing! As already written somewhere here in the discussion: |
Workflows, gitignore, pre-commit-config.yaml, setup.cfg, pyprojekt.toml changes that are not related to this PR need to be removed before this can be merged. I value all you guy's works, but someone needs to be the strict about how we go about it so we make sure this code is as good as it can be 🚀 |
The changes to the workflows are linked to the formatting of the code. So that will also mean work to roll it back again. |
@CM000n Thanks! Much appreciated ⭐ Related changes can still be part of this PR, and most of them are related. |
workflow changes afe now reverted
Status
This is the initial work on interfacing with the new API/Endpoints/application. It is very much a WIP(work in progress) but it does work to pull the basic information. No statistics, trips or HVAC all of which are possible and currently nothing can be sent back to the car(e.g. turn on your de-foggers) but again is possible when I work out the endpoint. However I've pushed it up for discussion as I want to propose a change and am after peoples thoughts.
Proposed Change
It currently seems that getting details about a car is split between interfaces
Vehicle
andMyT
. For example, if I want to know what the fuel level I callget_vehicle_status
with the VIN and inspect the returnedVehicle
object BUT if I want trip details I callget_trip
onMyT
with the VIN and a trip_id. I think a better approach is that all functionality for a Vehicle is called on a Vehicle object. This would mean thatMyT
only has two methodslogin
andget_vehicles
. The newget_vehicles
method returns a list ofVehicle
objects. For example,Why make this change:
vehicle.evRange
could update as it could make another call to the API to check. (I've noticed the new API is more responsive then the old)get_vehicle_electric_status_endpoint
does not exist on cars that are not electic/hybrid so the call fails, so why call it? All the capabilities are returned with the initial vehicle information in theextendedCapabilities
field this will be easy to manage when everything is handled in the one Vehicle class.Help needed
In the merge request there is a new file
simple_client_test.py
it would be helpful if people run it and tell me if it works.Finally
Thanks to wide wings and his work on another project that helped nail the authorisation(which is only slightly different). Unfortunately many of the endpoints are totally different.