Tesla account rapidly flapping OFFLINE/ONLINE


I’m running 4.1.1 under docker on Synology NAS. I had a stable Tesla account ‘Thing’ running and consistently online from January 17 until January 24, when I decided to remove and reinstall it in order to run discovery again (it had discovered two vehicles for some reason, one generic and one with the model that I have). Here’s the logs from event.log related to the Tesla account:

2024-01-17 01:39:51.718 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:fa0bc5151b' changed from UNKNOWN to ONLINE                                             
2024-01-24 02:20:57.917 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:fa0bc5151b' changed from ONLINE to UNINITIALIZED                                       
2024-01-24 02:20:58.004 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:fa0bc5151b' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)

So, no errors from the 17th until yesterday when I tried to reinstall it.

Initially I just deleted the Tesla account thing and created a new one with the exact same Refresh Token as I had used previously, but as soon as it came online it would go off again. The logs for that look like:

2024-01-25 13:36:50.411 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from OFFLINE to ONLINE                                             
2024-01-25 13:36:50.524 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from ONLINE to OFFLINE                                             
2024-01-25 13:37:05.525 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from OFFLINE to ONLINE                                             
2024-01-25 13:37:05.638 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from ONLINE to OFFLINE                                             
2024-01-25 13:37:20.638 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from OFFLINE to ONLINE                                             
2024-01-25 13:37:20.764 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from ONLINE to OFFLINE                                             
2024-01-25 13:37:35.764 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from OFFLINE to ONLINE                                             
2024-01-25 13:37:35.886 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from ONLINE to OFFLINE                                             
2024-01-25 13:37:50.889 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from OFFLINE to ONLINE                                             
2024-01-25 13:37:51.002 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from ONLINE to OFFLINE                                             
2024-01-25 13:38:06.002 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from OFFLINE to ONLINE

I tried testing the idea that my access token was invalid by replacing it with ‘abc’ and as far as I can tell I see exactly the same sequence in the event.log. First online, then immediately offline.

I then tried to generate new access tokens using the iOS ‘Auth for Tesla’ app, which is the same way I’d generated the working one originally. No joy. I’ve tried 3 or 4 other tools for generating refresh tokens, none of them seem to work.

I decided to check if TezLab, which also uses API access, can connect to my car. It does seem to, but it also is prompting me to update my connection:

Screenshot 2024-01-25 at 1.48.34 PM

This could be a wild goose chase, but here’s what they have to say about that:

I did follow their guidance and updated, but for the record, TezLab was communicating with my car before I updated the connection, and seems to be working fine after the update.

Can anyone suggest anything I can to do troubleshoot this? I don’t have access to Tesla’s API and there’s no error logged, just the ONLINE/OFFLINE message.

Update, I found something in openhab.log I had missed until now (not used to looking there):

==> events.log <==                                                                                                                                                                   
2024-01-25 14:01:13.445 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from ONLINE to OFFLINE                                             
2024-01-25 14:01:28.444 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from OFFLINE to ONLINE
2024-01-25 14:01:28.560 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tesla:account:3c709fac78' changed from ONLINE to OFFLINE         
                                                                                                                                                                                  ==> openhab.log <==                                                                                                                                                                  
2024-01-25 14:01:28.559 [ERROR] [internal.handler.TeslaAccountHandler] - Error fetching the list of vehicles : 412:org.apache.cxf.jaxrs.impl.ResponseImpl$1@29ded4b4

Has some change on Tesla’s side broken this binding?

Might be this:

Any ideas on how I could make that code change? I don’t see those files on my filesystem, and I’m not sure what to do with a .jar file mentioned in that issue’s discussion.

I also have a similar issue with the Tesla binding. I’m following the github issue that you just mentioned because I think Tesla changed the API and hope that someone can find the time to implement a fix


I made some test fixes based on Endpoint is only available on fleetapi · Issue #3629 · teslamate-org/teslamate · GitHub - https://smedley.id.au/tmp/org.openhab.binding.tesla-4.1.2-SNAPSHOT.jar
My changes are in Commits · psmedley/openhab-addons · GitHub

Both my cars are now online, but I haven’t had to check much more.

Long term, we need to find a way to move to the official API

Edit: Both cars were online

I put the https://smedley.id.au/tmp/org.openhab.binding.tesla-4.1.2-SNAPSHOT.jar in addons-folder.
The Tesla Bridge Account is now online but the vehicle thing is offline.
Log: [WARN ] [internal.handler.TeslaVehicleHandler] - Got an unsuccessful result, setting vehicle to offline and will try again

Yeah unfortunately there are more changes required.If nobody beats me to it, I’ll try and dig more later today


I’d be happy to help test, but I’m not sure how to get a new .jar file to be used instead of the one distributed with 4.1.1. I’m running in docker, and things are a bit different than a full linux distro.

Here’s what my addons folders look like:

root@a7debe86acd9:/openhab/addons# find / -name addons                                                                                                                               
/openhab/userdata/tmp/mvn/org/openhab/addons                                                                                                                                       root@a7debe86acd9:/openhab/addons# ls /openhab/addons/                                                                                                                               
root@a7debe86acd9:/openhab/addons# ls -1 /openhab/userdata/tmp/mvn/org/openhab/addons/bundles/org.openhab.binding.tesla/4.1.1/                                                       

I’m fairly comfortable with command line work, and linux in general, but I haven’t yet graduated from OpenHab user to OpenHab hacker!

Link is refreshed now and battery level at least has updated for me.

To install- remove the official binding, and copy the jar into /usr/share/openhab/addons


Will give a try and report the result - only thing I care is battery (it controls when to charge at cheapest hours).

1 Like

Can confirm it works for me, at least I can see remaining battery etc (for now).
Thanks a lot!

1 Like