Tesla items not updated after some time

Hi, I would like to revert back to the original problem of this thread with having the binding online but no update coming through anymore. Based on the suggestion from @billfor to put in place an openhab instance in the cloud to rule out WAF I did two fresh installs with tesla plugin only:

  1. Openhab on windows laptop within my own network → same problem as with my raspberry → after latest 1day no update coming through anymore
  2. Openhab at a AWS debian instance → no problem with this setup. Binding keept reporting it’s values for over one week without any issues!
  3. Same exact Openhab installation from (1) at a friends home → working flawless for more than a week!

With this test I think it’s been proven that the problem must have something todo with the local network/ISP. Anyone got a clue what I can do/check? As I have no idea would be great to get a hint.

1 Like

Thank you for trying this, really interesting result! I’m currently using openHAB 3.4.0.M2 on docker on an Intel NUC on my local network. If this is indeed a network issue, I’m curious as to what causes this. Do you have an idea?

If you could define the rule I pasted above and show the graph of the amount of time spent in the various states, that might indicate a next step.
Failing that and depending on your ISP, releasing the DHCP WAN address on your router and getting a new one would be enough to give a new external IP address and hopefully make the WAF happy. Some providers may require the router/modem to be turned off for a while before offering a new address.

Yesterday, I was able to set things up. I did the item, rule and sitemap but not yet activated the tesla binding on my production system. While doing this I shut down all testing instances to make sure nothing interferes. This morning before I drove to work I enabled the tesla binding on my production system where I have this issue. Binding went online for the account without trouble but car thing needed two tries (configuration error) to get online. Then I took my drive to work and binding was still online at the time I arrived. Also the graph shows this as it was online at the beginning and went to sleep after arrival:
image
This evening I drove home but as one can see binding is dead again even though account and car thing has been online. Any advice appreciated.

Hi again,

the binding seems to work quite ok. The changes are visible in OpenHAB after a delay. Sometimes quite short delay, sometimes a long delay. Since the charging process is not very time critical, it should work according to the needs.

Does anyone know how the binding is ‘talking’ to the car? Polling intervals or event driven?

You folks that are having the token refresh issue, which model tesla do you have?

I have a 2022 Model Y.
I haven’t done any debug, just configured yesterday first time ( 3.4.0.M3)
After configuring it works fine for a few hours and then in the Tesla Account thing it reports as per below, if I get a new token it works fine again for a few hours.

Status:

OFFLINE

CONFIGURATION_ERROR

Failed to obtain access token for API.

Try downloading the latest snapshot and run it with DEBUG logging: https://ci.openhab.org/job/openHAB-Addons/859/artifact/bundles/org.openhab.binding.tesla/target/org.openhab.binding.tesla-3.4.0-SNAPSHOT.jar
This version will print out the access token lifetime and also the expiration.

After 8 hours, when the access token refresh fails, post all lines related to the authentication at the time of the failure, and also the lines from when you first initialized the binding:

Here is what they should look like at the beginning of initialization:

[DEBUG] [binding.tesla.internal.handler.TeslaAccountHandler] - Initializing the Tesla account handler for bill
[DEBUG] [binding.tesla.internal.handler.TeslaAccountHandler] - Setting up an authenticated connection to the Tesla back-end
[DEBUG] [binding.tesla.internal.handler.TeslaAccountHandler] - Current authentication time 2022-10-16 13:25:53
[DEBUG] [hab.binding.tesla.internal.handler.TeslaSSOHandler] - Exchanging SSO refresh token for API access token
[DEBUG] [hab.binding.tesla.internal.handler.TeslaSSOHandler] - Access token expires in 28800 seconds at 2022-10-16 21:25:53
[DEBUG] [binding.tesla.internal.handler.TeslaAccountHandler] - Querying the vehicle: Response: 200: OK

Here is what they look like if the refresh is successful:

[DEBUG] [binding.tesla.internal.handler.TeslaVehicleHandler] - Vehicle state is asleep
[DEBUG] [binding.tesla.internal.handler.TeslaVehicleHandler] - Vehicle is asleep.
[DEBUG] [binding.tesla.internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 401, Unauthorized
[DEBUG] [binding.tesla.internal.handler.TeslaVehicleHandler] - The access token has expired, trying to get a new one.
[DEBUG] [binding.tesla.internal.handler.TeslaAccountHandler] - Current authentication time 2022-10-16 06:28:39
[DEBUG] [binding.tesla.internal.handler.TeslaAccountHandler] - Found a request token from 2022-10-15 22:28:36
[DEBUG] [binding.tesla.internal.handler.TeslaAccountHandler] - Access token expiration time 2022-10-16 06:28:36
[DEBUG] [binding.tesla.internal.handler.TeslaAccountHandler] - The access token has expired
[DEBUG] [hab.binding.tesla.internal.handler.TeslaSSOHandler] - Exchanging SSO refresh token for API access token
[DEBUG] [hab.binding.tesla.internal.handler.TeslaSSOHandler] - Access token expires in 28800 seconds at 2022-10-16 14:28:40

This should hopefully pinpoint the problem, if it is actually the Tesla WAF or something else.

Hi @billfor,

I did as you asked, downloaded the latest snapshot and ran it. Here are the log snippets:

Initialization:

2022-10-24 11:39:51.499 [DEBUG] [internal.handler.TeslaAccountHandler] - Initializing the Tesla account handler for XXX
2022-10-24 11:39:51.500 [DEBUG] [internal.handler.TeslaAccountHandler] - Setting up an authenticated connection to the Tesla back-end
2022-10-24 11:39:51.501 [DEBUG] [internal.handler.TeslaAccountHandler] - Current authentication time 2022-10-24 11:39:51
2022-10-24 11:39:51.501 [DEBUG] [sla.internal.handler.TeslaSSOHandler] - Exchanging SSO refresh token for API access token
2022-10-24 11:39:51.962 [DEBUG] [sla.internal.handler.TeslaSSOHandler] - Access token expires in 28800 seconds at 2022-10-24 19:39:51
2022-10-24 11:39:52.367 [DEBUG] [internal.handler.TeslaAccountHandler] - Querying the vehicle: Response: 200: OK

(Failed) Refresh:

2022-10-24 19:39:52.801 [DEBUG] [internal.handler.TeslaAccountHandler] - The access token has expired, trying to get a new one.
2022-10-24 19:39:52.802 [DEBUG] [internal.handler.TeslaAccountHandler] - Current authentication time 2022-10-24 19:39:52
2022-10-24 19:39:52.802 [DEBUG] [internal.handler.TeslaAccountHandler] - Found a request token from 2022-10-24 11:39:51
2022-10-24 19:39:52.803 [DEBUG] [internal.handler.TeslaAccountHandler] - Access token expiration time 2022-10-24 19:39:51
2022-10-24 19:39:52.803 [DEBUG] [internal.handler.TeslaAccountHandler] - The access token has expired
2022-10-24 19:39:52.803 [DEBUG] [sla.internal.handler.TeslaSSOHandler] - Exchanging SSO refresh token for API access token
2022-10-24 19:39:52.814 [DEBUG] [sla.internal.handler.TeslaSSOHandler] - An error occurred during refresh of SSO token: no response
2022-10-24 19:39:52.814 [DEBUG] [sla.internal.handler.TeslaSSOHandler] - An exception occurred while invoking a HTTP request: 'java.io.EOFException: HttpConnectionOverHTTP@5f786cc4::DecryptedEndPoint@52c399ec{l=/192.168.XX.XX:44736,r=auth.tesla.com/92.123.29.76:443,OPEN,fill=-,flush=-,to=28800850/0}'
2022-10-24 19:39:52.816 [DEBUG] [internal.handler.TeslaAccountHandler] - An error occurred while communicating with the vehicle during request drive_state: 401: Unauthorized

I don’t understand why the binding can retrieve an access token initially (and after each openhab restart) but not after 8 hours of running.

One thing you could try doing is to try to restart the binding manually right before the 8 hour mark and see if you can get an access token.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.