-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poll Nissan servers for battery updates #44826
Merged
Merged
Commits on Jan 4, 2021
-
Poll Nissan servers for battery updates
Restore the previous behaviour of checking the "OperationDateAndTime" value in the returned battery status, issuing a new battery check request if it hasn't changed. Also add the sleeps as discovered by @irekzielinski
Configuration menu - View commit details
-
Copy full SHA for df4064f - Browse repository at this point
Copy the full SHA df4064fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 55a8539 - Browse repository at this point
Copy the full SHA 55a8539View commit details -
Nissan may not return a start date, which is fine, but in that case we just have to return the data we have, instead of trying another 9 times and then returning it anyway.
Configuration menu - View commit details
-
Copy full SHA for cb04252 - Browse repository at this point
Copy the full SHA cb04252View commit details
Commits on Jan 5, 2021
-
`start_date is not None` can be simplified to just `start_date` thanks to @hencoappel Move static method `_extract_start_date` out of `LeafStore` since it doesn't really belong there (Maybe it should move to pycarwings2?) and to keep black happy. Makes the code look much cleaner to me.
Configuration menu - View commit details
-
Copy full SHA for 85ce087 - Browse repository at this point
Copy the full SHA 85ce087View commit details
Commits on Jan 8, 2021
-
Check get_latest_battery_status return
A few days of testing reveals that this method can return None. In an ideal world this function would just raise an exception, but here we are...
Configuration menu - View commit details
-
Copy full SHA for eeba2d5 - Browse repository at this point
Copy the full SHA eeba2d5View commit details
Commits on Jan 20, 2021
-
pycarwings2 can raise an exception if Nissan returns an empty list where battery records should be. My car stopped talking to me this week and this got the component completely stuck. Guard against this. I got the logic wrong. If we failed to get an initial "start_date", we can't know if the data has been refreshed, we just have to trust the Nissan servers and return the first data they give us. (OR, if we did get a start_date, wait until it has changed)
Configuration menu - View commit details
-
Copy full SHA for c1f6723 - Browse repository at this point
Copy the full SHA c1f6723View commit details
Commits on Apr 2, 2021
-
Check server_info, catch TypeError
server_info can be None, so make sure that it is valid before passing it to _extract_start_date. If you leave the car for a couple of weeks, the API behaves even more strangely. Later calls to get_latest_battery_status will also fail, and there's nothing we can do about that, so just add TypeError to the list of exceptions which will log an error and return None
Configuration menu - View commit details
-
Copy full SHA for c06fe80 - Browse repository at this point
Copy the full SHA c06fe80View commit details
Commits on Jun 11, 2021
-
Limit MAX_RESPONSE_ATTEMPTS to 3
If the Nissan servers aren't responding, it seems unlikely that more than 3 retries will be helpful. If they are really stuck, reducing the limit reduces the load on the servers by ~3. Sometimes, the servers need a delay of about a minute to get the data, so at least 2 retries are often necessary.
Configuration menu - View commit details
-
Copy full SHA for e38595b - Browse repository at this point
Copy the full SHA e38595bView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.