Skip to content

Avoid wake up loop during battery health check (soh test)#630

Open
RichieB2B wants to merge 1 commit intongardiner:mainfrom
RichieB2B:getCarApiRetryRemaining
Open

Avoid wake up loop during battery health check (soh test)#630
RichieB2B wants to merge 1 commit intongardiner:mainfrom
RichieB2B:getCarApiRetryRemaining

Conversation

@RichieB2B
Copy link

I ran a battery health check yesterday. A requirement is to be connected to a changer with a minimum of 5 kW power. The test starts with discharging the battery. This confuses TWCManager: it tries to start the charge but the start command receives this error as a response:

2025-10-31 22:08:51,662 - 🚗 TeslaAPI 20 ERROR "High energy features disabled during soh test" when trying to start car charging via Tesla car API.  Will try again later.

This error causes vehicle.lastErrorTime to be set and vehicle.ready() to return False.

However, TWCManager still tried to wake the car every 5 seconds:

2025-10-31 22:11:49,628 - 🚗 TeslaAPI 13 Car API cmd wake_up<Response [200]>
2025-10-31 22:11:55,739 - 🚗 TeslaAPI 13 Car API cmd wake_up<Response [200]>
2025-10-31 22:12:01,851 - 🚗 TeslaAPI 13 Car API cmd wake_up<Response [200]>
2025-10-31 22:12:07,870 - 🚗 TeslaAPI 13 Car API cmd wake_up<Response [200]>
2025-10-31 22:12:14,028 - 🚗 TeslaAPI 13 Car API cmd wake_up<Response [200]>

The wake up call is a charged Tesla Fleet API endpoint, so that turned out to be pretty expensive.

I think this can be avoided to call self.getCarApiRetryRemaining with the vehicle parameter. This will take into account the vehicle.lastErrorTime and backoff the wake up calls.

@RichieB2B RichieB2B changed the title Call getCarApiRetryRemaining(vehicle) in car_api_available() Avoid wake up look doing battery health check (son test) Nov 1, 2025
@RichieB2B RichieB2B changed the title Avoid wake up look doing battery health check (son test) Avoid wake up loop doing battery health check (son test) Nov 1, 2025
@RichieB2B RichieB2B changed the title Avoid wake up loop doing battery health check (son test) Avoid wake up loop during battery health check (son test) Nov 1, 2025
@RichieB2B RichieB2B changed the title Avoid wake up loop during battery health check (son test) Avoid wake up loop during battery health check (soh test) Nov 1, 2025
@RichieB2B RichieB2B force-pushed the getCarApiRetryRemaining branch from 1bc28a0 to 6c0adcb Compare November 1, 2025 17:28
@RichieB2B RichieB2B force-pushed the getCarApiRetryRemaining branch from 6c0adcb to 714641d Compare November 1, 2025 17:30
@MikeBishop
Copy link
Collaborator

You could also explicitly recognize the error that it fails with and consider that a successful wake, if the car is otherwise online. (Though I think the code already tries to check the car's status before waking it unnecessarily?)

@RichieB2B
Copy link
Author

RichieB2B commented Nov 2, 2025

That is a bit tricky. It is not the wake call that fails but the start charge call. We could ignore this specific error there but the car status will not indicate "charging".. that might lead to other problems. Perhaps a "start charge" loop..

The wake loop is caused by ready() returning false. Which is correct since there was an error.

I do believe calling getCarApiRetryRemaining without the vehicle parameter is actually a bug. The comment even mentions "this vehicle" which it currently is not checking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants