Kemmey / Kemmey-TeslaWatch-Public

40 stars 21 forks source link

Waking up the car way too often? #399

Open zef3215 opened 3 years ago

zef3215 commented 3 years ago

Hi Kim,

I'm using a different app to pull various information from my car. One aspect I noticed recently is that the car is consuming a lot more while in idle. Further to that, I notice that the care is waking up "apparently for no reasons" way too often. I disabled one by one other apps I'm using and the waking up seems to be linked to the Watch for Tesla app. Note, in the Watch for Tesla settings I set "Background updates" to OFF and did the same on the "Background App Refresh". Could this be related to some of the recent Updates from Tesla or your app? This is a bummer as I really like this app yet, at the moment I'm not using it as it takes too much energy/range from the car.

I hope you will be able to find what’s causing this. Regards, Florin. Wake logs

Kemmey commented 3 years ago

Hey @zef3215

Could you check settings in the app on both your phone and your watch? Do you have background updates disabled on both?

If background updates are disabled in the app on both watch, phone - possibly ipad and or mac - then there is zero possibility of the app scheduling any sort of background update on it's own. First line of the background update scheduler is checking for background updates being enabled - and likewise, first line of background task is checking if background updates are enabled - in both cases the methods just exit straight away.

You'll also be able to see background events from settings, if you tap on show debug you'll find all background events listed under the heading Background events.

I am quite interested though to hear specific numbers you've found about the increased battery drain due to waking the car frequently. I did my own testing on my model 3 lr and found the drain to be about 1% over 24 hours - and as such, completely negligible.

Cheers,

Kim

zef3215 commented 3 years ago

Hi Kim,

Background updates are disabled both on my phone and on the watch. I did some measurements before with Scan My Tesla connected to the car, and while awake (no Sentry Mode active) the car takes between 150W up to 300W. It does not sound much but if the car is awake often it will add up to some substantial amount. I record that here some time ago: https://youtu.be/Zm5qheG3M1g And yes, you are right, if the car will be kept at deep sleep all the time, it will consume "nothing" - about 300Wh per 24 hours (see min 8:00): https://youtu.be/sE88SfmQnRU

Justy to give you an idea of what I'm seeing right now: In my previous charge cycle, I've been using the car for 9 days and 7 hours and Tezlab is saying I was using 160Km of range while idle. Of course I was having short trips and the car kept awake for part of these trips yet... the number is huge. The current charge cycle was 2 days and 19 hours ago and 31 Km of range was used while idle without any "preconditioning" or camping in the car. I'm currently logged out from Watch my Tesla and I noticed the waking up does not seem to happen anymore. I will keep an eye on the energy consumption while idle.

I log in the app right now and all I see in "background events" is "Unable to read V3 token!" yet, the app seems to refresh well. This is puzzling me right now I have to say.

Unfortunately I did not pay much attention but this seems to have started after either of the following events which I got them more or less at the same time: Updated Tesla APP; Updated Watch my Tesla; Factory reset of my watch (I lock the watch by typing the wrong PIN multiple times).

If you have any other thoughts please let me know. Regards, Florin.

On Tue, 14 Sept 2021 at 09:26, Kim Hansen @.***> wrote:

Hey @zef3215 https://github.com/zef3215

Could you check settings in the app on both your phone and your watch? Do you have background updates disabled on both?

If background updates are disabled in the app on both watch, phone - possibly ipad and or mac - then there is zero possibility of the app scheduling any sort of background update on it's own. First line of the background update scheduler is checking for background updates being enabled - and likewise, first line of background task is checking if background updates are enabled - in both cases the methods just exit straight away.

You'll also be able to see background events from settings, if you tap on show debug you'll find all background events listed under the heading Background events.

I am quite interested though to hear specific numbers you've found about the increased battery drain due to waking the car frequently. I did my own testing on my model 3 lr and found the drain to be about 1% over 24 hours - and as such, completely negligible.

Cheers,

Kim

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Kemmey/Kemmey-TeslaWatch-Public/issues/399#issuecomment-918884728, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATOLNBQJKUA27XHYM4KPBYDUB32K3ANCNFSM5D7ONZTQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

thomasleitner commented 3 years ago

Is there any news about that? I’m reluctant to buy the App if such problems exist …

zef3215 commented 3 years ago

Is there any news about that? I’m reluctant to buy the App if such problems exist …

I've been monitoring this for the last two weeks and it turns out to be something related either with one of the recent Tesla APP update or (most likely) an app that I use for Smart Charging. Having said that, it doesn't seem to be anything wrong with "Watch for Tesla" app (sorry Kim). I have to tell you, I like the app better then Tesla APP, you can control most aspects from the Watch and comes with "build-in" shortcuts for Siri. It was my first purchase, few days after I got my M3 :)

NeskireDK commented 3 years ago

This is my monitoring of the app. Monitoring completely disabled in App, not in Watch. image Without app installed, the bar would be fully green, Fully asleep. But with WatchApp installed, it wakes the car every hour, for 18-21 minutes at a time. Doesn't even send a "sleep request". I know tesla's api isnt documented well, but please have a look at how the api crawler from TeslaMate works, as it does not keep the car awake, nor does it ever wake the car. yet it ALWAYS knows when the car is awake, and never misses a trip / tracking. It uses what is mentioned as Api streaming This app's default settings are meant for people who charge every day, for everyone else, its basically incompatible.

Suggestion:

NeskireDK commented 3 years ago

This is a comparison, of 17 hours of sleep with the app installed, default settings vs. not installed. While I appreciate you might have had multiple issues bugging you @zef3215, it remains clear that the app needlessly drains the car with state updates.

image

thomasleitner commented 3 years ago

I've also installed the App both on iPhone and Apple Watch. I got background updates disabled on both and do not see any particular high drain of the battery. Here's my log of teslafi.com:

image

NeskireDK commented 3 years ago

I've also installed the App both on iPhone and Apple Watch. I got background updates disabled on both and do not see any particular high drain of the battery. Here's my log of teslafi.com:

image

Agreed, I see the same, judging by the 5 hours of testing I did with your settings. The app unsurprisingly, doesn't wake and drain the car, when updates are disabled. However much of its functionality is the lost, which is a shame.

I think my point is, I want the best of both worlds, which luckily is possible, although just not currently with this app.

zef3215 commented 3 years ago

Yes, I confirm that if the app has the settings to not update in the background, it will not wake the car and do not trigger any battery drain. I'm fine with that setting and when I want a status update I manually tap the WatchforTesla "Complication" on the watch or open the app on my phone.

On Tue, 12 Oct 2021 at 13:37, André Eriksen @.***> wrote:

I've also installed the App both on iPhone and Apple Watch. I got background updates disabled on both and do not see any particular high drain of the battery. Here's my log of teslafi.com:

[image: image] https://user-images.githubusercontent.com/36305256/136948540-47211eb2-b906-4fd6-8397-d11fdca5f6b3.png

Agreed, I see the same, judging by the 5 hours of testing I did with your settings. The app unsurprisingly, doesn't wake and drain the car, when updates are disabled. However much of its functionality is the lost, which is a shame.

I think my point is, I want the best of both worlds, which luckily is possible, although just not currently with this app.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Kemmey/Kemmey-TeslaWatch-Public/issues/399#issuecomment-940926822, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATOLNBV3OAQZ2AMKOTRGA3LUGQMWJANCNFSM5D7ONZTQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Kemmey commented 3 years ago

Sorry for the lack of updates - my daughter was born on Friday and I've had other family priorities up to and after that :-D

As for the TeslaMate streaming support - this is impossible to implement in the app with the current architecture of not having a separately hosted backend. The watch or phone would drain to empty in a few hours if it were to stream continuously from the api just to monitor vehicle state.

If @NeskireDK you're not continuously plugging in your vehicle, just leave allow wake in background off - updates will still happen, but only if vehicle was already awake.

As for a sleep request - I must admit I've not seen that documented anywhere, but if that's an api endpoint that exists, I'll happily call it after every background update.

I'll look into how TeslaMate handles vehicle polling - currently when I connect to the streaming endpoints, I only receive data when vehicle is online - which is why streaming is only used in the app when vehicle is in drive state.

Kemmey commented 3 years ago

@NeskireDK I've had a look at the teslamate source, and I'm sorry to tell you, that there's no magic sauce in there.

Have a look at this readme explaining the differences between streaming and polling:

https://github.com/adriankumpf/teslamate/blob/41f1280e75e8f48db702f18755e1ce0ab1f044bd/website/docs/faq.md

Note that it is not possible to do background updates using streaming on iOS/watchOS, as background modes are severely limited by apple to conserve power on the host device.

Also, there is no "fall asleep" endpoint - I don't know where you have that information from, but teslamate does exactly the same as every other api implementation out there that I've come across - it stops polling the vehicle data endpoint for 15 minutes, waiting for the car to change state to asleep.

This is exactly the same as configuring watch app for Tesla to poll every hour but disallowing wake in background, except that the window for spotting vehicle online states is much smaller with a polling frequency of 1 hour and time-to-sleep in 15 minutes or less - there's only a less-than 25% chance to spot a vehicle online state change on a 1 hour poll interval. However, setting the poll interval to 15 minutes will quickly spend the approx 50 background update cycles allowed by watchOS.

TLDR; except for adding an unsafe custom backend, what you want is not possible.

Kemmey commented 3 years ago

@NeskireDK But thanks for the preemptive 1-star review! It's enthusiasm for my work such as yours that keeps me up late at night working harder to make the app better for everyone! /s