alandtse / tesla

Tesla custom integration for Home Assistant. This requires a refresh token be generated by third-party apps to login.
Apache License 2.0
586 stars 100 forks source link

Use Driving Polling Interval While HVAC Active #711

Open The00Dustin opened 1 year ago

The00Dustin commented 1 year ago

Is your feature request related to a problem? Please describe. I frequently make trips where I pick something up less than a mile from my destination. I hit keep climate on, go pick the something up, hop back in the vehicle, and drive to my final destination. Afterwards, much of the information in HA is wrong (arrival time, user presence times, shift state times, etc) until the next time I drive because it was waiting 10 minutes to poll again and all of that took less than 10 minutes. As far as I can tell, this data is lost instead of being picked up at the next polling interval because that sort of data either isn't collected when the vehicle isn't being driven or gets discarded by the vehicle or server at the end of drives.

Describe the solution you'd like Poll using the driving interval if the HVAC is running. If the HVAC system is running, the system isn't going to sleep, so using the driving polling interval shouldn't have any significant negative impact vs the parked polling interval.

Describe alternatives you've considered If I am correctly understanding that the first (up to 10 minute) part of a drive is collected when the integration polls after the vehicle starts being driven, it may also be possible to always check for such history, however, this would potentially be more costly in terms of energy while not being driven, and it might not work if that data is discarded after the vehicle is parked.

alandtse commented 1 year ago

Happy to take a PR. I wonder if keep climate on can be detected but maybe it's enough to poll based on if the AC is on? The concern of course is whether this may end up in a feedback loop somehow that prevents sleeping.