Skip to content
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

get_vehicle_status().dashboard.battery_level is not returning fresh data #239

Open
iksunen opened this issue Oct 3, 2023 · 5 comments
Open
Assignees
Labels

Comments

@iksunen
Copy link

iksunen commented Oct 3, 2023

Describe the bug
When the car is charging, get_vehicle_status().dashboard.battery_level does not return fresh data, but the data that was fetched when MyT app has refreshed charging status from the Remote Charging menu by clicking the refresh button (screenshot attached):

Screenshot

Not exactly sure if this falls under a bug or feature request, putting it under bug since to me it sounds like the current behaviour is somewhat misleading.

To Reproduce
Steps to reproduce the behavior:

  • Plug the car (Toyota RAV4 PHEV 2022) to charge
  • Run mytoyota client with the (cropped) code below:
from mytoyota.client import MyT

client = MyT(username=username, password=password, brand=brand)
await client.login()
vehicle = await client.get_vehicle_status(car)
charging_status = vehicle.dashboard.charging_status # this correctly returns 'charging' status
battery = vehicle.dashboard.battery_level # this will always return the same value while the car is charging

As per comment, when battery level is updated using the client, it returns the same value throughout the time that the car is charging.
Currently the only way to get an up-to-date charge value is by opening MyT app, going into Remote Charging menu and refreshing the data, which is obviously a blocker for doing automation using the client.

Expected behavior
Calling await client.get_vehicle_status(car).dashboard.battery_level should return up-to-date value on every call.


I meant to intercept the http request that the MyT app is performing when the refresh button is clicked, however so far the apk that's rebuilt with client certificates allowed fails on login step. If there's info on what toyota-europe API endpoint is used to refresh the data, it would also be of great help.

Thanks!

@joro75
Copy link
Collaborator

joro75 commented Nov 11, 2023

Thanks for the detailed description of your request. It is clear what you are observing, and I also fully understand the improvement you are suggesting.

The problem at this moment is that we have to find the API endpoint to trigger an update of the status information.
So we first have to determine this API endpoint, and then we can implement it.

@manelmg
Copy link

manelmg commented Dec 18, 2023

Any update about it?
Thanks

@GitOldGrumpy GitOldGrumpy self-assigned this Jan 8, 2024
@GitOldGrumpy
Copy link
Collaborator

Ill take a look at this. I would like the this for myself(so I can decide when to stop charging of my car for the next days travel) although that last time I looked I could not find the correct endpoint, but I did stop looking to concentrate on getting the API in better shape.

@CM000n CM000n removed the 💀 stale label Jan 9, 2024
@GitOldGrumpy
Copy link
Collaborator

@iksunen @manelmg if you could try pull request "WIP: Quick test code to check status of 'possible' refresh endpoints #302" and report back with what you find.

@iksunen
Copy link
Author

iksunen commented Jan 25, 2024

@iksunen @manelmg if you could try pull request "WIP: Quick test code to check status of 'possible' refresh endpoints #302" and report back with what you find.

Getting the following log prints with PR branch changes when running simple_client_example.py:

/v1/global/remote/electric/realtime-status: {'status': {'messages': [{'responseCode': 'ONE-GLOBAL-RS-10000', 'description': 'Request Completed Successfully', 'detailedDescription': 'Request Completed Successfully'}]}, 'payload': {'appRequestNo': 'fd1e6a67-8ca4-3d30-96d9-b223d0ee19e6', 'returnCode': '000000'}}
/v1/global/remote/refresh-status: Threw Request Failed.  500, {"message": "Internal server error"}.
/v1/global/remote/refresh-climate-status: {'status': {'messages': [{'responseCode': 'ONE-GLOBAL-RS-10000', 'description': 'Request Completed Successfully', 'detailedDescription': 'Request Completed Successfully'}]}, 'payload': {'appRequestNo': '7ac9c710-a0e4-30d2-90b3-84ff52725df7', 'returnCode': '000000'}}

And unfortunately the battery level printed is still not up-to-date, i.e. calling the electric/realtime-status endpoint does not seem to do the trick, and the refresh-status request is failing.

Not sure if it matters, but I switched to the newer version of MyT app recently so the vehicle has been migrated to use that.

UPDATE: it does work now! I see the charge percentage being updated. Sorry about the confusion last time, the charge level was at 97% and I notice that at higher charge the percentage is not always accurate and might jump to 100% all of a sudden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants