Closed gthbcrvs closed 3 months ago
Same issue here. Looks like a server side change caused the scripting to fail.
Noted some issues uploading trip details around the same time, but these resolved over the last few days.
Pushed a fix to branch Issue_363 which has it working for me, if someone else could validate.
@GitOldGrumpy VIN is also missing in NotificationModel
Pushed a fix to branch Issue_363 which has it working for me, if someone else could validate.
Didn't work for me:
mytoyota-Issue_363/simple_client_example.py:85: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
Logging in...
Retrieving cars...
Traceback (most recent call last):
File "/Users//Downloads/mytoyota-Issue_363/simple_client_example.py", line 86, in
Pushed a fix to branch Issue_363 which has it working for me, if someone else could validate.
In the same file /mytoyota/models/endpoints/notifications.py
, in addition to setting Line 64 to default to None
, we need to do the same thing for _PayloadItemModel.vin
on Line 46.
Changing this makes it work for me.
My github knowledge is too lacking for me to be able to create a PR for this.
Ok, I think I managed to create a PR for this.
Pushed a fix to branch Issue_363 which has it working for me, if someone else could validate.
In the same file
/mytoyota/models/endpoints/notifications.py
, in addition to setting Line 64 to default toNone
, we need to do the same thing for_PayloadItemModel.vin
on Line 46. Changing this makes it work for me.My github knowledge is too lacking for me to be able to create a PR for this.
If you remove the VIN only the main car is retrieved.
I only have a single car, so I can't fully back this up with data. We are not removing the VIN for the request, only that the model validation for the response does not required a VIN at the payload level.
When performing a GET
request to get the notifications from endpoint /v2/notification/history
, one of the supplied parameters to Controller.request_json()
is the VIN
.
The response I see today is in the following format (anonimysed and trunkated the payload array):
As you can see the response payload for this specific vehicle does not include the VIN in the payload
object.
{
"request": {
"method": "GET",
"endpoint": "/v2/notification/history",
"vin": "«VIN»",
"body": null,
"params": null,
"headers": null
},
"response": {
"statusCode": 200,
"headers": {
"Content-Type": "text/plain"
},
"body": "Success",
"payload": [
{
"notifications": [
{
"title": null,
"message": "«Message»",
"isRead": false,
"notificationGroupId": null,
"notificationDate": "2024-08-11T18:15:51.246Z",
"displayCategory": "Vehicle Alerts",
"messageId": "«ID»",
"vin": "«VIN»",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"type": "alert",
"category": "VehicleStatusAlert",
"status": "0"
},
{
"title": null,
"message": "«Message»",
"isRead": false,
"notificationGroupId": null,
"notificationDate": "2024-08-11T17:55:11.156Z",
"displayCategory": "Vehicle Alerts",
"messageId": "«ID»",
"vin": "«VIN»",
"iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/critical_alert.png",
"type": "alert",
"category": "VehicleStatusAlert",
"status": "0"
}
]
}
]
}
}
I have still error:
Exception has occurred: ValidationError
1 validation error for NotificationResponseModel
payload -> 0 -> vin
field required (type=value_error.missing)
File "Y:\Projects_Docker\mytoyota\mytoyota\api.py", line 55, in _request_and_parse
return model(**response)
^^^^^^^^^^^^^^^^^
File "Y:\Projects_Docker\mytoyota\mytoyota\api.py", line 199, in get_notification_endpoint
parsed_response = await self._request_and_parse(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "Y:\Projects_Docker\mytoyota\mytoyota\models\vehicle.py", line 100, in parallel_wrapper
r = await function()
^^^^^^^^^^^^^^^^
File "Y:\Projects_Docker\mytoyota\mytoyota\models\vehicle.py", line 106, in update
for name, data in await responses:
^^^^^^^^^^^^^^^
File "Y:\Projects_Docker\mytoyota\simple_client_example.py", line 50, in get_information
await car.update()
File "Y:\Projects_Docker\mytoyota\simple_client_example.py", line 86, in
Neither of my cars have any notifications which is why I missed this. Also having no notifications I cant check if the fix works correctly for people having multiple cars.
Changing the VIN as ajain has should work fine as nothing then uses the value, just need confirmation.
Neither of my cars have any notifications which is why I missed this. Also having no notifications I cant check if the fix works correctly for people having multiple cars.
Changing the VIN as ajain has should work fine as nothing then uses the value, just need confirmation.
I have a single car with several notification and it doesn't work.
If can help to solve.... this is my Response, that generate error on this block:
async def _request_and_parse(self, model, method: str, endpoint: str, kwargs): """Parse requests and responses.""" response = await self.controller.request_json(method=method, endpoint=endpoint, kwargs) return model(**response)
Exception has occurred: ValidationError 1 validation error for NotificationResponseModel payload -> 0 -> vin field required (type=value_error.missing)
{ "statusCode": 200, "headers": { "Content-Type": "text/plain" }, "body": "Success", "payload": [ { "notifications": [ { "title": None, "message": "2023 bZ4X: Ricarica interrotta [Errore:4].", "isRead": false, "notificationGroupId": None, "notificationDate": "2024-08-12T10:41:32.516Z", "displayCategory": "General", "messageId": "66b9e6dc344c3ce244c3018d", "vin": "VIN", "iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/general.png", "type": "alert", "category": "ChargingAlert", "status": "completed" }, { "title": None, "message": "2023 bZ4X: Ricarica interrotta [Errore:4].", "isRead": false, "notificationGroupId": None, "notificationDate": "2024-08-11T14:25:04.634Z", "displayCategory": "General", "messageId": "66b8c9c03139d591a694741b", "vin": "VIN", "iconUrl": "https://assets.preprod.ctdevops.com/assets/notification/icons/general.png", "type": "alert", "category": "ChargingAlert", "status": "completed" },
I've pulled across @ajain-93 change if people want to test again.
I've pulled across @ajain-93 change if people want to test again.
Now it works for me. Thanks
I've pulled across @ajain-93 change if people want to test again.
This worked!
What would be the next step in solving this issue?
We would need to update this module, as well as update the requirement in ha_toyota
to solve issue https://github.com/DurgNomis-drol/ha_toyota/issues/286 to get the HA integration running again.
Fetching the car info works for me now. (Never seen notifications for my car yet)
Fixed here, needs someone to update the ha_toyota.
@GitOldGrumpy @CM000n We also need to make a new release to enable fix of DurgNomis-drol/ha_toyota#286. Any ideas on how to proceed on that?
@GitOldGrumpy @CM000n We also need to make a new release to enable fix of DurgNomis-drol/ha_toyota#286. Any ideas on how to proceed on that?
@DurgNomis-drol seems to have been difficult to reach for some time. Unfortunately, he is the only one who can publish new releases for ha_toyota
.
Because of this, and because I also have a lot going on in my private life, the development from my side has almost come to a standstill.
@DurgNomis-drol seems to have been difficult to reach for some time. Unfortunately, he is the only one who can publish new releases for
ha_toyota
. Because of this, and because I also have a lot going on in my private life, the development from my side has almost come to a standstill.
@CM000n Thanks for creating a new release. We just need to wait for @DurgNomis-drol to approve https://github.com/DurgNomis-drol/ha_toyota/issues/287.
Describe the bug It appears there has been a change on Toyota's side that breaks this module since some day's after August 4th.
To Reproduce Steps to reproduce the behavior:
C:\Users\xxx\simple_client_example.py:77: DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop() Logging in... Retrieving cars... Traceback (most recent call last): File "C:\Users\xxx\simple_client_example.py", line 78, in <module> loop.run_until_complete(get_information()) File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\xxx\simple_client_example.py", line 49, in get_information await car.update() File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\mytoyota\models\vehicle.py", line 106, in update for name, data in await responses: ^^^^^^^^^^^^^^^ File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\mytoyota\models\vehicle.py", line 100, in parallel_wrapper r = await function() ^^^^^^^^^^^^^^^^ File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\mytoyota\api.py", line 199, in get_notification_endpoint parsed_response = await self._request_and_parse( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\mytoyota\api.py", line 55, in _request_and_parse return model(**response) ^^^^^^^^^^^^^^^^^ File "pydantic\main.py", line 341, in pydantic.main.BaseModel.__init__ pydantic.error_wrappers.ValidationError: 1 validation error for NotificationResponseModel guid field required (type=value_error.missing)
Expected behavior The expected data.
Additional context Also added as an issue in the ha_toyota repository: https://github.com/DurgNomis-drol/ha_toyota/issues/286