zabuldon / teslajsonpy

Apache License 2.0
57 stars 62 forks source link

fix: Improve wake up retry logic #379

Closed carleeno closed 1 year ago

carleeno commented 1 year ago

The wake_up decorator was removed as it was only used for the api() method. The wake_if_asleep logic has been refactored between the Controller.wake_up and Controller.api methods and made to be more readable and handle edge cases better:

It'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

carleeno commented 1 year ago

(in draft while I finish some real world testing)