-
Notifications
You must be signed in to change notification settings - Fork 82
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
check_and_force_update_vehicles not refreshing data #425
Comments
Does it work in the mobile app? If not you may have used the max force calls for the day. I have heard it may only be 10 a day now. |
Not only it works on the phone app, it also works when I use the force refresh without the check. |
ok, I wasn't seeing anything in the debugger, so I added some extra debug lines (simple 'prints') to the code:
And the output was:
So I realized that the update_all_vehicles_with_cached_state needs to be called BEFORE and AFTER check_and_force_update_vehicles
Ant it worked:
So, if I understood well the logic of check_and_force_update_vehicles:
So, since we need to update from cache before using the check_and_update, we have two scenarios:
So, I wonder whether it would more efficient to make a call to update_all_vehicles_with_cached_state ALWAYS from within check_and_force_update_vehicles. At least we would be saving one of the calls in scenario 1. I would even argue that probably it would be better to also add the initial call to update_all_vehicles_with_cached_state in the check_and_force_update_vehicles, so it would be transparent to the user. Thoughts? |
I sat to read this a bit more. Couple things to note:
The API covers multiple use cases. In some situations this library is active for months at a time and not restarted regularly. As such you don't hit the no data situation. Seems like in your case you aren't keeping it running long term. Home assistant is the example of this. |
Hi, I'm not and don't want to run a full refresh every 30 minutes, just wanted to be sure that when I run it and get the data, it is updated, so no older than 30 minutes. But anyway, ok, thanks for your comments. |
Got it. So if that's the case from your side I would have your code call a get cached call first followed by an if statement to determine if the data is too old for your requirements. If it is call a force refresh which should update the vehicle object. |
So basically implementing the 'check and refresh' in my code instead of using the 'standard' method. Gotcha. |
Description
The method check_and_force_update_vehicles is not doing what expected, not refreshing the data (or I don't know how to use it).
I am trying to get an updated status of the car if the last update is over 30 minutes old, but I am getting always the old cached information.
What I Did
I built a small script to get the car status:
But the result is not the expected, and clearly it is over 30 minutes since last update (actually, over 90 minutes):
If I try to forcing the refresh without the check, it works:
I saw at the issue #412 that check_and_force_update_vehicles doesn't refresh the VM object, that's why I am making a call to update_all_vehicles_with_cached_state after it, but still it is showing the old information.
I may be missing something, but I cannot find what.
The text was updated successfully, but these errors were encountered: