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.
The wake_up decorator was removed as it was only used for the
api()
method. Thewake_if_asleep
logic has been refactored between theController.wake_up
andController.api
methods and made to be more readable and handle edge cases better:wake_if_asleep=True
, it will raise an exceptionwake_if_asleep=True
and the car has gone to sleep so recently that the Controller doesn't know it yet, the initial api request will fail, but now it will handle that gracefully, wake the vehicle, and try the command againIt's also more efficient by only retrying the wake command if it failed, otherwise it waits for it to come online by polling the
VEHICLE_SUMMARY
endpoint at regular intervals with it's own timeout.(split out from #373)
Tested with HA dev container and model 3
wake_if_asleep=True
(climate on) while car was asleep would wake the car, only sending 1 wake request, and then detect that the car waked (it took ~8 seconds)wake_if_asleep=False
(climate off) while car was asleep would not wake the car, and logs would not show an error that the car was unavailablewake_if_asleep=True
while car was awake would not try to wake the car