bassmaster187 / TeslaLogger

TeslaLogger is a self hosted data logger for your Tesla Model S/3/X/Y. Actually it supports RaspberryPi 3B, 3B+, 4B, Docker and Synology NAS.
https://www.teslalogger.de
GNU General Public License v3.0
505 stars 167 forks source link

no more communication with the car? #1137

Closed danpadure closed 8 months ago

danpadure commented 9 months ago

nohup.zip Append Logfile you find it here: \raspberry\teslalogger\nohup.out

Describe the bug Since 6 dec Teslalogger does not seem to communicate with the car anymore

In the log I see errors like: 06.12.2023 07:03:16 : #2[Car_2:17]: HttpStatusCode = Unauthorized. Password changed or still valid? 0

06.12.2023 07:03:50 : Exec_mono: /usr/bin/du -sk /etc/teslalogger/Exception

06.12.2023 07:04:17 : #2[Car_2:17]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

Teslalogger Type Docker Did you update the Image with apt-get update & upgrade? no

Do you use Tasker or iBeacon Tasker

ThmsD commented 9 months ago

Same thing happened to me last night. Creating a new token within Teslalogger fixed it for me.

ThmsD commented 9 months ago

Well, okay..

05.12.2023 22:09:00 : #1[Thread Pool Worker:33426]: Update Tesla Token From Refresh Token!
05.12.2023 22:09:00 : #1[Thread Pool Worker:33426]: HttpStatus: Forbidden
05.12.2023 22:09:00 : #1[Thread Pool Worker:33426]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

Then I created a new token within Teslalogger and my trip this morning was recorded, but after I had parked my car the error came back.

06.12.2023 07:15:25 : #1[Car_1:72]: Waiting for car to go to sleep 10
06.12.2023 07:15:30 : #1[StreamAPIThread_1:74]: Update Tesla Token From Refresh Token!
06.12.2023 07:15:30 : #1[StreamAPIThread_1:74]: HttpStatus: Forbidden
06.12.2023 07:15:30 : #1[StreamAPIThread_1:74]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

danpadure commented 9 months ago

I will try too

danpadure commented 9 months ago

so far the new token works for me

bassmaster187 commented 9 months ago

so issue can be closed?

danpadure commented 9 months ago

Let's give it another day. For me it works so far, but ThmsD said he needed to reset again the token

Mario4git commented 9 months ago

An new created token (created over settings menu) works only for some hours.

I'm not sure, how often an token must renew, but if the token shall renewed I get following messages in log:

06.12.2023 09:35:30 : #1[Car_1:17]: ScanMyTesla FastMode: False
06.12.2023 09:35:30 : Distance: 2.76367771452769 - Radius: 50 - XXXXXXXXXXXXXXXXXXXX
06.12.2023 09:35:30 : Reverse geocoding by Geofence
06.12.2023 09:35:30 : #1[Thread Pool Worker:418]: HttpStatusCode = Unauthorized. Password changed or still valid? 13
06.12.2023 09:43:00 : #1[Thread Pool Worker:418]: Update Tesla Token From Refresh Token!
06.12.2023 09:43:01 : #1[Thread Pool Worker:418]: HttpStatus: Forbidden
06.12.2023 09:43:01 : #1[Thread Pool Worker:418]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue () [0x002b3] in :0
at Newtonsoft.Json.JsonTextReader.Read () [0x0004c] in :0
at Newtonsoft.Json.JsonReader.ReadAndMoveToContent () [0x00000] in :0
at Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) [0x0004a] in :0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000db] in :0
at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00054] in :0
at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in :0
at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x0002d] in :0
at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value) [0x00000] in :0
at TeslaLogger.WebHelper.UpdateTeslaTokenFromRefreshToken () [0x0020e] in :0
06.12.2023 09:43:01 : #1[Car_1:17]: Unhandled State: NULL

Is it possible that Tesla has changed the interface/API?

I think 06.12.2023 09:43:01 : #1[Thread Pool Worker:418]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0. is an indication for this.

Obviously the response provided cannot be processed.

superfloh247 commented 9 months ago

you have to regenerate both tokens

ThmsD commented 9 months ago

Several people had this problem in the TFF forum. Perhaps it has not yet been finally solved and will reappear despite token renewal, as it happened to me a second time.

Mario4git commented 9 months ago

Yes, I mean so. I used the browser option and copied the link and clicked "Tokens holen" (0:00 today). I mean, it has created an Access Token and a Refresh Token.

ostorezio commented 9 months ago

Opppsss ... sorry Could someone please remind me the token update procedure? Thank you in advance

Mario4git commented 9 months ago

http://<your teslalogger IP>:8888/admin/password.php

bassmaster187 commented 9 months ago

It happen to me as well. I forced to refresh the access token and it didn't work.

image

a couple of minutes later, it works. image

so let's pin this issue until we know if there are just outages by tesla server or any other problem.

danpadure commented 9 months ago

For it worked until ~15 min ago.
Now again: 06.12.2023 15:49:40 : #2[Thread Pool Worker:1111]: HttpStatusCode = Unauthorized. Password changed or still valid? 0

The car was sleeping during this time, I checked the 12 battery monitor. So the car is not a factor, I guess while the car is asleep there is no communication to the Tesla server

ThmsD commented 9 months ago

This morning when the car fell asleep, I had the same problem as now in the evening when the car fell asleep. I don't know if there is a connection.

06.12.2023 07:14:25 : #1[Car_1:72]: Waiting for car to go to sleep 9 06.12.2023 07:14:36 : #1[StreamAPIThread_1:74]: Stream: Timeout 06.12.2023 07:14:57 : #1[StreamAPIThread_1:74]: Stream: Timeout 06.12.2023 07:15:18 : #1[StreamAPIThread_1:74]: Stream: Timeout 06.12.2023 07:15:25 : #1[Car_1:72]: Waiting for car to go to sleep 10 06.12.2023 07:15:30 : #1[StreamAPIThread_1:74]: Update Tesla Token From Refresh Token! 06.12.2023 07:15:30 : #1[StreamAPIThread_1:74]: HttpStatus: Forbidden 06.12.2023 07:15:30 : #1[StreamAPIThread_1:74]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

06.12.2023 16:40:47 : #1[Car_1:1286]: Waiting for car to go to sleep 15 06.12.2023 16:40:57 : #1[StreamAPIThread_1:1289]: Stream: Timeout 06.12.2023 16:41:19 : #1[StreamAPIThread_1:1289]: Stream: Timeout 06.12.2023 16:41:40 : #1[StreamAPIThread_1:1289]: Stream: Timeout 06.12.2023 16:41:47 : #1[Car_1:1286]: Waiting for car to go to sleep 16 06.12.2023 16:42:01 : #1[StreamAPIThread_1:1289]: Stream: Timeout 06.12.2023 16:42:22 : #1[StreamAPIThread_1:1289]: Stream: Timeout 06.12.2023 16:42:34 : #1[StreamAPIThread_1:1289]: Update Tesla Token From Refresh Token! 06.12.2023 16:42:34 : #1[StreamAPIThread_1:1289]: HttpStatus: Forbidden 06.12.2023 16:42:34 : #1[StreamAPIThread_1:1289]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

ostorezio commented 9 months ago

http://:8888/admin/password.php

No reply from this URL

ostorezio commented 9 months ago

:8888 not required in URL Now I can get to the token instructions, Thanks

bassmaster187 commented 9 months ago

Today both of my access token has to be refreshed. I have two cars in my account: My Model S:

07.12.2023 08:45:46 : #1[Car_1:19]: Restore Token too old! 11/5/2022 4:12:41 PM
07.12.2023 08:45:46 : #1[Car_1:19]: Update Tesla Token From Refresh Token!
07.12.2023 08:45:48 : #1[Car_1:19]: HttpStatus: Forbidden

one second later, the Model 3 works well:

07.12.2023 08:45:49 : #3[Car_3:21]: Restore Token too old! 12/7/2022 5:50:39 AM
07.12.2023 08:45:49 : #3[Car_3:21]: Update Tesla Token From Refresh Token!
07.12.2023 08:45:50 : #3[Car_3:21]: HttpStatus: OK
07.12.2023 08:45:50 : #3[Car_3:21]: UpdateRefreshToken
07.12.2023 08:45:50 : #3[Car_3:21]: UpdateRefreshToken OK: 1
07.12.2023 08:45:50 : #3[Car_3:21]: UpdateTeslaToken
07.12.2023 08:45:50 : #3[Car_3:21]: update tesla_token OK: 1
07.12.2023 08:45:51 : #3[Car_3:21]: TOKEN: xxxxxxxx
07.12.2023 08:45:52 : #3[StreamAPIThread_3:24]: StartStream
07.12.2023 08:45:52 : #3[Car_3:21]: display_name: Tessi
07.12.2023 08:45:52 : #3[Car_3:21]: vin: 5YJ3E7EA3LFXXXXXX
07.12.2023 08:45:52 : #3[Car_3:21]: id: X49X9XX26XX8X32X
07.12.2023 08:45:52 : #3[Car_3:21]: vehicle_id: X50X7XX1
danpadure commented 9 months ago

for my Model3, again just now: 07.12.2023 09:08:46 : #2[Thread Pool Worker:1791]: Update Tesla Token From Refresh Token! 07.12.2023 09:08:46 : #2[Thread Pool Worker:1791]: HttpStatus: Forbidden

Ventusfahrer commented 9 months ago

Hi All,

in the German Tesla Drivers and Friends Forum we already had a more detailed discussion.

When reading

https://developer.tesla.com/docs/fleet-api#fleet-telemetry

It appears, that the API teslalogger is using, is going to be deprecated very soon. If my fear is right, we will see nothing more (even when trying to update the Tokens) in exactl 24 days.

Most propable the Token Update Errors are more or less planed by Tesla in order to point the users to this situation.

Someone has probably to migrate to the new SDK-Interface in order to keep teslalogger running in 2024?

bassmaster187 commented 9 months ago

Someone has probably to migrate to the new SDK-Interface in order to keep teslalogger running in 2024?

Well, I'll do it, but I need to know if there will be an affordable subscription plan. Tesla doesn't offer anything now worth spending hundreds of hours of coding for 1 API requests / 5 min.

And I think the current problem isn't related to the deprecation of the API.

image

image

danpadure commented 9 months ago

wow, it seems big changes coming up one way on another this could mess up the entire teslalogger structure

bassmaster187 commented 9 months ago

without any changes both of my cars can refresh the access token:

Model S:

07.12.2023 21:25:01 : #1[Car_1:19]: Restore Token too old! 12/7/2021 4:18:17 PM
07.12.2023 21:25:01 : #1[Car_1:19]: Update Tesla Token From Refresh Token!
07.12.2023 21:25:02 : #1[Car_1:19]: HttpStatus: OK
07.12.2023 21:25:02 : #1[Car_1:19]: UpdateRefreshToken
07.12.2023 21:25:02 : #1[Car_1:19]: UpdateRefreshToken OK: 1
07.12.2023 21:25:02 : #1[Car_1:19]: UpdateTeslaToken
07.12.2023 21:25:02 : #1[Car_1:19]: update tesla_token OK: 1

Model 3:

07.12.2023 21:24:47 : #3[Car_3:20]: Restore Token too old! 12/7/2021 5:06:39 PM
07.12.2023 21:24:48 : #3[Car_3:20]: Update Tesla Token From Refresh Token!
07.12.2023 21:24:49 : #3[Car_3:20]: HttpStatus: OK
07.12.2023 21:24:49 : #3[Car_3:20]: UpdateRefreshToken
07.12.2023 21:24:49 : #3[Car_3:20]: UpdateRefreshToken OK: 1
07.12.2023 21:24:49 : #3[Car_3:20]: UpdateTeslaToken
07.12.2023 21:24:49 : #3[Car_3:20]: update tesla_token OK: 1

Very hard to find some issues if somtimes it works

rf23 commented 9 months ago

my m3 is able to refresh the token as well even though it first showed the same parsing error (two minutes later the token was refreshed on a 2nd try)?

image
Ventusfahrer commented 9 months ago

on my installation the situation has improved a lot compared to the 6th of december:

root@7vhas:~/TeslaLogger/TeslaLogger/bin# grep -i 'unexpected character encountered ' nohup.out  | wc -l
93
root@7vhas:~/TeslaLogger/TeslaLogger/bin# grep -i 'unexpected character encountered ' nohup.out  | grep '06.12.' |wc -l
36
root@7vhas:~/TeslaLogger/TeslaLogger/bin# grep -i 'unexpected character encountered ' nohup.out  | grep '07.12.' |wc -l
1
root@7vhas:~/TeslaLogger/TeslaLogger/bin# grep -i 'unexpected character encountered ' nohup.out  | grep '08.12.' |wc -l
0

my installation started logging at 08.11.2023.

bassmaster187 commented 9 months ago

My Teslalogger got 4 times in a row a new vaild access token. So it seams like someone restarted some server at tesla headquarter :-)

danpadure commented 9 months ago

no more problems for me either, today so fingers cross until.. january 2024?

ThmsD commented 9 months ago

Worked fine a few times, but tonight I got the error again twice before renewing the token worked again.

08.12.2023 20:56:44 : #1[Car_1:2257]: Waiting for car to go to sleep 0
08.12.2023 20:56:46 : #1[StreamAPIThread_1:4818]: shift_state: Power: 0 Datetime: 08.12.2023 20:56:45

08.12.2023 20:57:07 : #1[StreamAPIThread_1:4818]: Update Tesla Token From Refresh Token!
08.12.2023 20:57:07 : #1[StreamAPIThread_1:4818]: HttpStatus: Forbidden
08.12.2023 20:57:07 : #1[StreamAPIThread_1:4818]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0. (...)
08.12.2023 20:57:08 : #1[Thread Pool Worker:5204]: Request StopStreaming
08.12.2023 20:57:08 : #1[StreamAPIThread_1:4818]: StreamEnd
08.12.2023 20:57:08 : #1[StreamAPIThread_1:4818]: StartStream Ende
08.12.2023 20:57:09 : #1[StreamAPIThread_1:5300]: StartStream
08.12.2023 20:57:10 : #1[StreamAPIThread_1:5300]: Update Tesla Token From Refresh Token!
08.12.2023 20:57:10 : #1[StreamAPIThread_1:5300]: HttpStatus: Forbidden
08.12.2023 20:57:10 : #1[StreamAPIThread_1:5300]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0. (...)
08.12.2023 20:57:10 : #1[Thread Pool Worker:5204]: Request StopStreaming
08.12.2023 20:57:10 : #1[StreamAPIThread_1:5300]: StreamEnd
08.12.2023 20:57:10 : #1[StreamAPIThread_1:5300]: StartStream Ende
08.12.2023 20:57:11 : #1[StreamAPIThread_1:5301]: StartStream
08.12.2023 20:57:12 : #1[StreamAPIThread_1:5301]: Update Tesla Token From Refresh Token!
08.12.2023 20:57:13 : #1[StreamAPIThread_1:5301]: HttpStatus: OK
08.12.2023 20:57:13 : #1[StreamAPIThread_1:5301]: UpdateRefreshToken
08.12.2023 20:57:13 : #1[StreamAPIThread_1:5301]: UpdateRefreshToken OK: 1
08.12.2023 20:57:13 : #1[StreamAPIThread_1:5301]: UpdateTeslaToken
08.12.2023 20:57:13 : #1[StreamAPIThread_1:5301]: update tesla_token OK: 1
08.12.2023 20:57:13 : #1[Thread Pool Worker:5285]: Request StopStreaming
08.12.2023 20:57:13 : #1[Thread Pool Worker:5204]: Request StopStreaming
08.12.2023 20:57:13 : #1[StreamAPIThread_1:5301]: StreamEnd
08.12.2023 20:57:13 : #1[StreamAPIThread_1:5301]: StartStream Ende
08.12.2023 20:57:14 : #1[StreamAPIThread_1:5302]: StartStream
08.12.2023 20:57:17 : #1[StreamAPIThread_1:5302]: shift_state: Power: 0 Datetime: 08.12.2023 20:57:15

08.12.2023 20:57:44 : #1[Car_1:2257]: Waiting for car to go to sleep 1
bassmaster187 commented 9 months ago

this night i hat the same problem. after 5 retries I got a new access token:

09.12.2023 05:35:03 : #3[Thread Pool Worker:3094]: Update Tesla Token From Refresh Token!
09.12.2023 05:35:04 : #3[Thread Pool Worker:3094]: HttpStatus: Forbidden
09.12.2023 05:35:04 : #3[Thread Pool Worker:3094]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value ...

09.12.2023 05:35:06 : #1[Thread Pool Worker:3094]: HttpStatusCode = Unauthorized. Password changed or still valid? 0
09.12.2023 05:36:06 : #1[Thread Pool Worker:3094]: Update Tesla Token From Refresh Token!
09.12.2023 05:36:06 : #1[Thread Pool Worker:3094]: HttpStatus: Forbidden
09.12.2023 05:36:06 : #1[Thread Pool Worker:3094]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value:

09.12.2023 05:39:08 : #1[Thread Pool Worker:3121]: Update Tesla Token From Refresh Token!
09.12.2023 05:39:08 : #1[Thread Pool Worker:3121]: HttpStatus: Forbidden
09.12.2023 05:39:08 : #1[Thread Pool Worker:3121]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value:

09.12.2023 05:39:39 : #1[Thread Pool Worker:3103]: HttpStatusCode = Unauthorized. Password changed or still valid? 2
09.12.2023 05:41:39 : #1[Thread Pool Worker:3103]: Update Tesla Token From Refresh Token!
09.12.2023 05:41:39 : #1[Thread Pool Worker:3103]: HttpStatus: Forbidden
09.12.2023 05:41:39 : #1[Thread Pool Worker:3103]: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value

09.12.2023 05:42:10 : #1[Thread Pool Worker:3103]: HttpStatusCode = Unauthorized. Password changed or still valid? 3
09.12.2023 05:44:40 : #1[Thread Pool Worker:3103]: Update Tesla Token From Refresh Token!
09.12.2023 05:44:41 : #1[Thread Pool Worker:3103]: HttpStatus: OK
09.12.2023 05:44:41 : #1[Thread Pool Worker:3103]: UpdateRefreshToken
09.12.2023 05:44:41 : #1[Thread Pool Worker:3103]: UpdateRefreshToken OK: 1
09.12.2023 05:44:41 : #1[Thread Pool Worker:3103]: UpdateTeslaToken
09.12.2023 05:44:41 : #1[Thread Pool Worker:3103]: update tesla_token OK: 1
danpadure commented 9 months ago

me too, but at different hour: 1:21 - 1:31 after 6 retries i got a new token it's strange how the errors occur at different time, I would expect us all to have issues at the same time.

bassmaster187 commented 9 months ago

it's strange how the errors occur at different time, I would expect us all to have issues at the same time.

Good point. It seems like that problem is reported constantly with a low rate, but in the last 24 hours at approx 7pm there was an huge peek. And just 52% are affected.

image

qudiqudi commented 9 months ago

I encountered the same, my install had lost connection around the same time as everybody else in this thread. Same log messages... I just noticed it right now - which means I lost a week worth of data - pretty annoying. We need some kind of alert notification if something like this happens, because teslalogger just goes silent and you wouldn't notice if you don't check on a daily basis.

adnet-solutions commented 9 months ago

i have same issue. i lost connection. After i rereate token it was working for 2 days. Now its again without connection. With that i cant use teslalogger :-(

adnet-solutions commented 8 months ago

@bassmaster187 is there any update on that. or any workarround?

danpadure commented 8 months ago

I haven't had any more problems since. Am I lucky or has Tesla solved the issue?

rowich commented 8 months ago

It works for me since then (provide new tokens once) also.

danpadure commented 8 months ago

it works since reported, it seems it was a tesla server glitch