llamafilm / tesla-http-proxy-addon

Tesla HTTP Proxy Add-on for Home Assistant
Apache License 2.0
45 stars 19 forks source link

Invalid public key #135

Closed guidoffm closed 2 months ago

guidoffm commented 3 months ago

The problem

Also everything looks good and I am displayed all the metrics, when I try to invoke an action, eg. "Flash Lights", then I see in the log the command is sent to the fleet api and it returns 200. But after this I get "invalid public key".

What version of the addon are you using?

2.2.8

What version of Home Assistant Core are you using?

core-2024.7.3

What type of installation are you running?

Home Assistant OS

What version of Tesla integration are you using?

No response

What region of Tesla API are you using?

Europe, Middle East

What model and year is your vehicle?

Y

What is your domain name (FQDN)?

tesla.edvmueller.de

Paste the log output from the addon here

2024-07-20T13:49:51+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"redacted"}
2024-07-20T13:49:51+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"redacted"}
2024-07-20T13:49:52+02:00 [debug] Server returned 200: OK: {"response":"MhISECjfIOVR19dqRsXfF2UwSrs6AggCegIoAZIDEB7yYCTtVYyJk6f5oSYD+Eg="}
2024-07-20T13:49:52+02:00 [warn ] [1ef26024ed558c8993a7f9a12603f848] Discarding unauthenticated session info
2024-07-20T13:49:52+02:00 [warn ] [1ef26024ed558c8993a7f9a12603f848] Session info error: BadParameter: invalid public key
2024-07-20T13:49:52+02:00 [error] Returning error Internal Server Error
2024-07-20T13:49:52+02:00 [debug] [64fb8d51bb1e736a05d910f7ee158cd2] Retrying transmission after error: Post "https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command": context canceled

Any additional context or screenshots that help explain the issue

No response

llamafilm commented 3 months ago

It sounds like you did not enroll the public key in your vehicle. Did you skip that step? Share the debug log during that process if it's not working.

guidoffm commented 3 months ago

At least the Tesla app said the key was successfully installed.

guidoffm commented 3 months ago

More log:

content-type: application/x-x509-ca-cert
content-length: 178
last-modified: Sat, 20 Jul 2024 11:10:38 GMT
etag: "669b9b2e-b2"
accept-ranges: bytes
cf-cache-status: DYNAMIC
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=vXmN5YXcLxiIlGmlIVtlIyTv1Odx66dQ%2Fvvt8QE3%2FY4OVVzs4diZvt%2F%2FJHMTy%2F6vYRk88IQ6N5RwZbFEYn7ey6TJy%2ByyArtDD7O56Bhk%2BP2BZnoTfd0suMjOxHQS6c%2F4%2BL%2FLU3xt"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 8a64b42fba09440b-EWR
alt-svc: h3=":443"; ma=86400

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkgmKAzftPgjCBLfRusyJWo/Lr5YN
5j51mk040WYQn5hXpze2gciTlwdRpH1LYn7IggMgLjFYKVzYDB6YeEkL/A==
-----END PUBLIC KEY-----
[19:34:46] INFO: Running auth.py
[19:34:46] auth:INFO: Generating Partner Authentication Token
[19:34:46] urllib3.connectionpool:DEBUG: Starting new HTTPS connection (1): auth.tesla.com:443
[19:34:46] urllib3.connectionpool:DEBUG: https://auth.tesla.com:443 "POST /oauth2/v3/token HTTP/1.1" 200 822
[19:34:46] auth:DEBUG: {"access_token":"redacted","expires_in":28800,"token_type":"Bearer"}
[19:34:46] auth:INFO: Registering Tesla account...
[19:34:46] urllib3.connectionpool:DEBUG: Starting new HTTPS connection (1): fleet-api.prd.eu.vn.cloud.tesla.com:443
[19:34:47] urllib3.connectionpool:DEBUG: https://fleet-api.prd.eu.vn.cloud.tesla.com:443 "POST /api/1/partner_accounts HTTP/1.1" 200 None
[19:34:47] auth:DEBUG: {"response":{"account_id":"7db2bd3b-e2d9-456f-88d6-9aaa9604d87f","domain":"tesla.edvmueller.de","name":"tesla.edvmueller.de2","description":"https://tesla.edvmueller.de","csr":null,"client_id":"2c938ba4-231b-4fe0-8be0-62d74cf4c09d","ca":null,"created_at":"2024-07-13T09:54:26.003Z","updated_at":"2024-07-20T11:37:39.067Z","enterprise_tier":"discovery","issuer":null,"csr_updated_at":null,"public_key":"0492098a0337ed3e08c204b7d1bacc895a8fcbaf960de63e759a4d38d166109f9857a737b681c893970751a47d4b627ec88203202e3158295cd80c1e9878490bfc"}}
[19:34:47] urllib3.connectionpool:DEBUG: Starting new HTTP connection (1): supervisor:80
[19:34:47] urllib3.connectionpool:DEBUG: http://supervisor:80 "GET /addons/self/options/config HTTP/1.1" 200 226
[19:34:47] urllib3.connectionpool:DEBUG: Starting new HTTP connection (1): supervisor:80
[19:34:47] urllib3.connectionpool:DEBUG: http://supervisor:80 "POST /addons/self/options HTTP/1.1" 200 25
[19:34:47] INFO: Starting Tesla HTTP Proxy

Do not listen on a network interface without adding client authentication. Unauthorized clients may
be used to create excessive traffic from your IP address to Tesla's servers, which Tesla may respond
to by rate limiting or blocking your connections.
2024-07-20T19:34:47+02:00 [debug] Creating proxy
2024-07-20T19:34:47+02:00 [info ] Listening on 0.0.0.0:443
2024-07-20T19:35:01+02:00 [info ] Received GET request for /api/1/products
2024-07-20T19:35:01+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/products
[19:35:43] werkzeug:INFO: 172.30.32.2 - - [20/Jul/2024 19:35:43] "GET / HTTP/1.1" 200 -
2024-07-20T19:36:01+02:00 [info ] Received GET request for /api/1/products
2024-07-20T19:36:01+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/products
[19:36:24] webui:DEBUG: Callback URL: https://tesla.edvmueller.de/callback?code=EU_8fab1d7eb1194a74733c7beebe186381916e83a72f5d19563dffeb4ae107&state=85b1bbe6f8&issuer=https%3A%2F%2Fauth.tesla.com%2Foauth2%2Fv3
[19:36:24] webui:DEBUG: code: EU_8fab1d7eb1194a74733c7beebe186381916e83a72f5d19563dffeb4ae107
[19:36:24] urllib3.connectionpool:DEBUG: Starting new HTTPS connection (1): auth.tesla.com:443
[19:36:24] urllib3.connectionpool:DEBUG: https://auth.tesla.com:443 "POST /oauth2/v3/token HTTP/1.1" 200 1393
[19:36:24] webui:WARNING: Obtained refresh token: redacted
[19:36:24] werkzeug:INFO: 172.30.32.2 - - [20/Jul/2024 19:36:24] "GET /callback?callback_url=https://tesla.edvmueller.de/callback?code%3DEU_8fab1d7eb1194a74733c7beebe186381916e83a72f5d19563dffeb4ae107%26state%3D85b1bbe6f8%26issuer%3Dhttps%253A%252F%252Fauth.tesla.com%252Foauth2%252Fv3 HTTP/1.1" 200 -
[19:36:39] werkzeug:INFO: 172.30.32.2 - - [20/Jul/2024 19:36:39] "GET / HTTP/1.1" 200 -
2024-07-20T19:37:01+02:00 [info ] Received GET request for /api/1/products
2024-07-20T19:37:01+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/products
2024-07-20T19:38:02+02:00 [info ] Received GET request for /api/1/products
2024-07-20T19:38:02+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/products
2024-07-20T19:38:15+02:00 [info ] Received POST request for /api/1/vehicles/LRWYGCEK1PC702540/command/flash_lights
2024-07-20T19:38:15+02:00 [debug] Executing flash_lights on LRWYGCEK1PC702540
2024-07-20T19:38:15+02:00 [info ] Starting dispatcher service...
2024-07-20T19:38:15+02:00 [info ] Requesting session info from DOMAIN_INFOTAINMENT
2024-07-20T19:38:15+02:00 [info ] Requesting session info from DOMAIN_VEHICLE_SECURITY
2024-07-20T19:38:15+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAzoSEhBpX5AS4BkNDcaiOW/W1txLmgMQWTiygpF4AHfCIhifQOu3MHJDCkEETzDKIzLHiyIbcxlYtTKauBhHIelDzrfE/0mhOLIVZg89RgjCfkwlLx3cFeFJHjdzWNnSbd8Jye5GEyuE0K8ZHQ=="}
2024-07-20T19:38:15+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAjoSEhDHhWZByytqlY2pVLRdUTgEmgMQxzO+GYlvi0Yjucbf28ALwnJDCkEETzDKIzLHiyIbcxlYtTKauBhHIelDzrfE/0mhOLIVZg89RgjCfkwlLx3cFeFJHjdzWNnSbd8Jye5GEyuE0K8ZHQ=="}
2024-07-20T19:38:16+02:00 [debug] Server returned 200: OK: {"response":"MhISEMeFZkHLK2qVjalUtF1ROAQ6AggCegIoAZIDEMczvhmJb4tGI7nG39vAC8I="}
2024-07-20T19:38:16+02:00 [warn ] [c733be19896f8b4623b9c6dfdbc00bc2] Discarding unauthenticated session info
2024-07-20T19:38:16+02:00 [warn ] [c733be19896f8b4623b9c6dfdbc00bc2] Session info error: BadParameter: invalid public key
2024-07-20T19:38:16+02:00 [error] Returning error Internal Server Error
2024-07-20T19:38:16+02:00 [debug] [5938b28291780077c222189f40ebb730] Retrying transmission after error: Post "https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command": context canceled
2024-07-20T19:38:17+02:00 [info ] Received POST request for /api/1/vehicles/LRWYGCEK1PC702540/command/flash_lights
2024-07-20T19:38:17+02:00 [debug] Executing flash_lights on LRWYGCEK1PC702540
2024-07-20T19:38:17+02:00 [info ] Starting dispatcher service...
2024-07-20T19:38:17+02:00 [info ] Requesting session info from DOMAIN_VEHICLE_SECURITY
2024-07-20T19:38:17+02:00 [info ] Requesting session info from DOMAIN_INFOTAINMENT
2024-07-20T19:38:17+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAzoSEhDvEGO2w7uKzNp1C17UTInYmgMQr8mnvFrI0RbC7fYic7bTXHJDCkEETzDKIzLHiyIbcxlYtTKauBhHIelDzrfE/0mhOLIVZg89RgjCfkwlLx3cFeFJHjdzWNnSbd8Jye5GEyuE0K8ZHQ=="}
2024-07-20T19:38:17+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAjoSEhABtADob6Tc5hSKk/61UoMrmgMQU0UdwlB5+HNcwESfW39pi3JDCkEETzDKIzLHiyIbcxlYtTKauBhHIelDzrfE/0mhOLIVZg89RgjCfkwlLx3cFeFJHjdzWNnSbd8Jye5GEyuE0K8ZHQ=="}
2024-07-20T19:38:18+02:00 [debug] Server returned 200: OK: {"response":"MhISEAG0AOhvpNzmFIqT/rVSgys6AggCegIoAZIDEFNFHcJQefhzXMBEn1t/aYs="}
2024-07-20T19:38:18+02:00 [warn ] [53451dc25079f8735cc0449f5b7f698b] Discarding unauthenticated session info
2024-07-20T19:38:18+02:00 [warn ] [53451dc25079f8735cc0449f5b7f698b] Session info error: BadParameter: invalid public key
2024-07-20T19:38:18+02:00 [error] Returning error Internal Server Error
2024-07-20T19:38:18+02:00 [debug] [afc9a7bc5ac8d116c2edf62273b6d35c] Retrying transmission after error: Post "https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command": context canceled
2024-07-20T19:38:20+02:00 [info ] Received POST request for /api/1/vehicles/LRWYGCEK1PC702540/command/flash_lights
2024-07-20T19:38:20+02:00 [debug] Executing flash_lights on LRWYGCEK1PC702540
2024-07-20T19:38:20+02:00 [info ] Starting dispatcher service...
2024-07-20T19:38:20+02:00 [info ] Requesting session info from DOMAIN_INFOTAINMENT
2024-07-20T19:38:20+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAzoSEhDmMdecKm4SbSR3NGUxz61QmgMQCwiiBTviAgtCz5Qs8zUxh3JDCkEETzDKIzLHiyIbcxlYtTKauBhHIelDzrfE/0mhOLIVZg89RgjCfkwlLx3cFeFJHjdzWNnSbd8Jye5GEyuE0K8ZHQ=="}
2024-07-20T19:38:20+02:00 [info ] Requesting session info from DOMAIN_VEHICLE_SECURITY
2024-07-20T19:38:20+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAjoSEhB/Wt1rEYnDEZzB+ZJvEzMmmgMQUh8SxABBRYAolT+Qv0t9MHJDCkEETzDKIzLHiyIbcxlYtTKauBhHIelDzrfE/0mhOLIVZg89RgjCfkwlLx3cFeFJHjdzWNnSbd8Jye5GEyuE0K8ZHQ=="}
2024-07-20T19:38:21+02:00 [debug] Server returned 200: OK: {"response":"MhISEH9a3WsRicMRnMH5km8TMyY6AggCegIoAZIDEFIfEsQAQUWAKJU/kL9LfTA="}
2024-07-20T19:38:21+02:00 [warn ] [521f12c40041458028953f90bf4b7d30] Discarding unauthenticated session info
2024-07-20T19:38:21+02:00 [warn ] [521f12c40041458028953f90bf4b7d30] Session info error: BadParameter: invalid public key
2024-07-20T19:38:21+02:00 [error] Returning error Internal Server Error
2024-07-20T19:38:21+02:00 [debug] [0b08a2053be2020b42cf942cf3353187] Retrying transmission after error: Post "https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command": context canceled
2024-07-20T19:38:26+02:00 [info ] Received POST request for /api/1/vehicles/LRWYGCEK1PC702540/command/flash_lights
2024-07-20T19:38:26+02:00 [debug] Executing flash_lights on LRWYGCEK1PC702540
2024-07-20T19:38:26+02:00 [info ] Starting dispatcher service...
2024-07-20T19:38:26+02:00 [info ] Requesting session info from DOMAIN_INFOTAINMENT
2024-07-20T19:38:26+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAzoSEhBJz6UhKoQRp6CyS+xQr5bSmgMQEV8qmV+ZeW39bbJXaVGRb3JDCkEETzDKIzLHiyIbcxlYtTKauBhHIelDzrfE/0mhOLIVZg89RgjCfkwlLx3cFeFJHjdzWNnSbd8Jye5GEyuE0K8ZHQ=="}
2024-07-20T19:38:26+02:00 [info ] Requesting session info from DOMAIN_VEHICLE_SECURITY
2024-07-20T19:38:26+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAjoSEhDuT/Wqxw0v2r/aurefiBT8mgMQ+KXDZ7xbxGeMGnbL4cwXYnJDCkEETzDKIzLHiyIbcxlYtTKauBhHIelDzrfE/0mhOLIVZg89RgjCfkwlLx3cFeFJHjdzWNnSbd8Jye5GEyuE0K8ZHQ=="}
2024-07-20T19:38:27+02:00 [debug] Server returned 429: Too Many Requests: Retry in 22894 seconds

2024-07-20T19:38:27+02:00 [warn ] [f8a5c367bc5bc4678c1a76cbe1cc1762] Terminal transmission error: Retry in 22894 seconds

2024-07-20T19:38:27+02:00 [error] Returning error Too Many Requests
2024-07-20T19:38:27+02:00 [debug] [115f2a995f99796dfd6db2576951916f] Retrying transmission after error: Post "https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command": context canceled
guidoffm commented 3 months ago

By the way: Do you know about a way to remove unused app registrations from the Tesla developer console? I don't see any delete button.

llamafilm commented 3 months ago

No, unfortunately I have not seen any way to remove app registrations.

If the iOS app says it was enrolled successfully then that should be fine, but just to double check, I suggest removing the addon, then add it back and run through the whole initial setup again.

If that still doesn't work, I'm wondering if the vehicle maybe doesn't like something in the HTTP headers on your key. Here's what I see in curl verbose output.

My key:

< HTTP/2 200 
< server: nginx
< date: Sat, 20 Jul 2024 17:48:56 GMT
< content-type: text/plain
< content-length: 178
< last-modified: Sun, 16 Jun 2024 23:14:19 GMT
< etag: "666f71cb-b2"
< strict-transport-security: max-age=31536000; includeSubDomains
< accept-ranges: bytes
< 
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHggC/GbzC3PbkvtriyggMclhOBg4
8qJ31poCBQhgsYoQb8iFqKt5x8eE+tWVm6qeRLO0Cm5EESABnrOxB5/m2A==
-----END PUBLIC KEY-----

Your key:

< HTTP/2 200 
< date: Sat, 20 Jul 2024 17:49:46 GMT
< content-type: application/x-x509-ca-cert
< content-length: 178
< last-modified: Sat, 20 Jul 2024 11:10:38 GMT
< etag: "669b9b2e-b2"
< accept-ranges: bytes
< cf-cache-status: DYNAMIC
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=q%2B1BJyimJgV%2FGIRZeysaCtEonPo%2F7KpYgzkyD9HiW8ueCqsnEc4EcSbeqm8Utl2oJAh2K80j9M244QV5Q9nG4fibRZ4kqPu5RoInrvyKHgM46oAneKcuQZG8mdKqjaAn7974IJc2"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: 8a64ca2a98291029-LAX
< alt-svc: h3=":443"; ma=86400
< 
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkgmKAzftPgjCBLfRusyJWo/Lr5YN
5j51mk040WYQn5hXpze2gciTlwdRpH1LYn7IggMgLjFYKVzYDB6YeEkL/A==
-----END PUBLIC KEY-----
guidoffm commented 3 months ago

Unfortunately the problem still exists:

2024-07-21T07:27:24+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/products
2024-07-21T07:28:13+02:00 [info ] Received POST request for /api/1/vehicles/LRWYGCEK1PC702540/wake_up
2024-07-21T07:28:13+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/wake_up
2024-07-21T07:28:15+02:00 [info ] Received GET request for /api/1/vehicles/LRWYGCEK1PC702540
2024-07-21T07:28:15+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540
2024-07-21T07:28:17+02:00 [info ] Received GET request for /api/1/vehicles/LRWYGCEK1PC702540
2024-07-21T07:28:17+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540
2024-07-21T07:28:19+02:00 [info ] Received GET request for /api/1/vehicles/LRWYGCEK1PC702540
2024-07-21T07:28:19+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540
2024-07-21T07:28:20+02:00 [info ] Received POST request for /api/1/vehicles/LRWYGCEK1PC702540/command/flash_lights
2024-07-21T07:28:20+02:00 [debug] Executing flash_lights on LRWYGCEK1PC702540
2024-07-21T07:28:20+02:00 [info ] Starting dispatcher service...
2024-07-21T07:28:20+02:00 [info ] Requesting session info from DOMAIN_INFOTAINMENT
2024-07-21T07:28:20+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAzoSEhAZpUH1Sgamr7V152PauI4AmgMQeYLno+Nhx6tBpmhPuKr7qHJDCkEExVEojGEydPERXuyndplgCdoPGh5eiMKqz1zVl+VPIyVHQMWMt2Yq1jReaYTKzioC0IHqLgBfuvmkv5sW2BAL5g=="}
2024-07-21T07:28:20+02:00 [info ] Requesting session info from DOMAIN_VEHICLE_SECURITY
2024-07-21T07:28:20+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAjoSEhBpz6WHImCl5BuGdL3dOqTLmgMQnPAJYjhamPa6A5vfPqOjwXJDCkEExVEojGEydPERXuyndplgCdoPGh5eiMKqz1zVl+VPIyVHQMWMt2Yq1jReaYTKzioC0IHqLgBfuvmkv5sW2BAL5g=="}
[07:28:20] werkzeug:INFO: 172.30.32.2 - - [21/Jul/2024 07:28:20] "GET / HTTP/1.1" 200 -
2024-07-21T07:28:20+02:00 [debug] Server returned 200: OK: {"response":"MhISEGnPpYciYKXkG4Z0vd06pMs6AggCegIoAZIDEJzwCWI4Wpj2ugOb3z6jo8E="}
2024-07-21T07:28:20+02:00 [warn ] [9cf00962385a98f6ba039bdf3ea3a3c1] Discarding unauthenticated session info
2024-07-21T07:28:20+02:00 [warn ] [9cf00962385a98f6ba039bdf3ea3a3c1] Session info error: BadParameter: invalid public key
2024-07-21T07:28:20+02:00 [error] Returning error Internal Server Error
2024-07-21T07:28:20+02:00 [debug] [7982e7a3e361c7ab41a6684fb8aafba8] Retrying transmission after error: Post "https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command": context canceled
2024-07-21T07:28:22+02:00 [info ] Received POST request for /api/1/vehicles/LRWYGCEK1PC702540/command/flash_lights
2024-07-21T07:28:22+02:00 [debug] Executing flash_lights on LRWYGCEK1PC702540
2024-07-21T07:28:22+02:00 [info ] Starting dispatcher service...
2024-07-21T07:28:22+02:00 [info ] Requesting session info from DOMAIN_INFOTAINMENT
2024-07-21T07:28:22+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAzoSEhB6ZlstBsqCtWz+PBoHjy06mgMQKwEYVqkTO8eA/B9nUJgq0XJDCkEExVEojGEydPERXuyndplgCdoPGh5eiMKqz1zVl+VPIyVHQMWMt2Yq1jReaYTKzioC0IHqLgBfuvmkv5sW2BAL5g=="}
2024-07-21T07:28:22+02:00 [info ] Requesting session info from DOMAIN_VEHICLE_SECURITY
2024-07-21T07:28:22+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAjoSEhA+RCTbOdn8mQcRx7A6Fg9RmgMQ4SVmXBtHgDpdAyNjP7jvn3JDCkEExVEojGEydPERXuyndplgCdoPGh5eiMKqz1zVl+VPIyVHQMWMt2Yq1jReaYTKzioC0IHqLgBfuvmkv5sW2BAL5g=="}
2024-07-21T07:28:22+02:00 [debug] Server returned 200: OK: {"response":"MhISED5EJNs52fyZBxHHsDoWD1E6AggCYgQIARABkgMQ4SVmXBtHgDpdAyNjP7jvnw=="}
2024-07-21T07:28:22+02:00 [debug] [2b011856a9133bc780fc1f6750982ad1] Retrying transmission after error: Post "https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command": context canceled
2024-07-21T07:28:23+02:00 [info ] Received GET request for /api/1/vehicles/LRWYGCEK1PC702540/vehicle_data
2024-07-21T07:28:23+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/vehicle_data?endpoints=charge_state%3Bclimate_state%3Bdrive_state%3Bgui_settings%3Bvehicle_config%3Bvehicle_state%3Blocation_data
2024-07-21T07:28:23+02:00 [info ] Requesting session info from DOMAIN_INFOTAINMENT
2024-07-21T07:28:23+02:00 [info ] Requesting session info from DOMAIN_VEHICLE_SECURITY
2024-07-21T07:28:23+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAjoSEhDYkstOY0S+iH2IfetdF1xpmgMQVEIS29nWtpIAhmv6NFjffXJDCkEExVEojGEydPERXuyndplgCdoPGh5eiMKqz1zVl+VPIyVHQMWMt2Yq1jReaYTKzioC0IHqLgBfuvmkv5sW2BAL5g=="}
2024-07-21T07:28:23+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAzoSEhB6ZlstBsqCtWz+PBoHjy06mgMQi1P0dyItE2TvmrN//7mvUXJDCkEExVEojGEydPERXuyndplgCdoPGh5eiMKqz1zVl+VPIyVHQMWMt2Yq1jReaYTKzioC0IHqLgBfuvmkv5sW2BAL5g=="}
2024-07-21T07:28:24+02:00 [info ] Received GET request for /api/1/products
2024-07-21T07:28:24+02:00 [debug] Forwarding request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/products
2024-07-21T07:28:24+02:00 [debug] Server returned 200: OK: {"response":"MhISENiSy05jRL6IfYh9610XXGk6AggCegIoAZIDEFRCEtvZ1raSAIZr+jRY330="}
2024-07-21T07:28:24+02:00 [warn ] [544212dbd9d6b69200866bfa3458df7d] Discarding unauthenticated session info
2024-07-21T07:28:24+02:00 [warn ] [544212dbd9d6b69200866bfa3458df7d] Session info error: BadParameter: invalid public key
2024-07-21T07:28:24+02:00 [error] Returning error Internal Server Error
2024-07-21T07:28:24+02:00 [debug] [8b53f477222d1364ef9ab37fffb9af51] Retrying transmission after error: Post "https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command": context canceled
2024-07-21T07:28:27+02:00 [info ] Received POST request for /api/1/vehicles/LRWYGCEK1PC702540/command/flash_lights
2024-07-21T07:28:27+02:00 [debug] Executing flash_lights on LRWYGCEK1PC702540
2024-07-21T07:28:27+02:00 [info ] Starting dispatcher service...
2024-07-21T07:28:27+02:00 [info ] Requesting session info from DOMAIN_INFOTAINMENT
2024-07-21T07:28:27+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAzoSEhB8OVcpH8dY2dBt7GiPu3CsmgMQGBBiY+7TbNzWGG0Buti3xXJDCkEExVEojGEydPERXuyndplgCdoPGh5eiMKqz1zVl+VPIyVHQMWMt2Yq1jReaYTKzioC0IHqLgBfuvmkv5sW2BAL5g=="}
2024-07-21T07:28:27+02:00 [info ] Requesting session info from DOMAIN_VEHICLE_SECURITY
2024-07-21T07:28:27+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAjoSEhAIVJUitUxHGM26Au7peRTimgMQlKprvy6CNOLfy6QGw/TYYXJDCkEExVEojGEydPERXuyndplgCdoPGh5eiMKqz1zVl+VPIyVHQMWMt2Yq1jReaYTKzioC0IHqLgBfuvmkv5sW2BAL5g=="}
2024-07-21T07:28:27+02:00 [debug] Server returned 200: OK: {"response":"MhISEHw5Vykfx1jZ0G3saI+7cKw6AggDYgQIAhADkgMQGBBiY+7TbNzWGG0Buti3xQ=="}
2024-07-21T07:28:27+02:00 [error] Returning error Internal Server Error
2024-07-21T07:28:27+02:00 [debug] [94aa6bbf2e8234e2dfcba406c3f4d861] Retrying transmission after error: Post "https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command": context canceled
2024-07-21T07:28:31+02:00 [info ] Received POST request for /api/1/vehicles/LRWYGCEK1PC702540/command/flash_lights
2024-07-21T07:28:31+02:00 [debug] Executing flash_lights on LRWYGCEK1PC702540
2024-07-21T07:28:31+02:00 [info ] Starting dispatcher service...
2024-07-21T07:28:31+02:00 [info ] Requesting session info from DOMAIN_INFOTAINMENT
2024-07-21T07:28:31+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAzoSEhANGIyLCu9MxQUORzL1vngVmgMQJXsTGIRYaWVIbwyGLQsuknJDCkEExVEojGEydPERXuyndplgCdoPGh5eiMKqz1zVl+VPIyVHQMWMt2Yq1jReaYTKzioC0IHqLgBfuvmkv5sW2BAL5g=="}
2024-07-21T07:28:31+02:00 [info ] Requesting session info from DOMAIN_VEHICLE_SECURITY
2024-07-21T07:28:31+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command: {"routable_message":"MgIIAjoSEhDIHIIOJRf0lsZ6h+jgJRoTmgMQXySc2i7rkHZRXMYYVWnD53JDCkEExVEojGEydPERXuyndplgCdoPGh5eiMKqz1zVl+VPIyVHQMWMt2Yq1jReaYTKzioC0IHqLgBfuvmkv5sW2BAL5g=="}
2024-07-21T07:28:32+02:00 [debug] Server returned 200: OK: {"response":"MhISEMgcgg4lF/SWxnqH6OAlGhM6AggCegIoAZIDEF8knNou65B2UVzGGFVpw+c="}
2024-07-21T07:28:32+02:00 [warn ] [5f249cda2eeb9076515cc6185569c3e7] Discarding unauthenticated session info
2024-07-21T07:28:32+02:00 [warn ] [5f249cda2eeb9076515cc6185569c3e7] Session info error: BadParameter: invalid public key
2024-07-21T07:28:32+02:00 [error] Returning error Internal Server Error
2024-07-21T07:28:32+02:00 [debug] [257b131884586965486f0c862d0b2e92] Retrying transmission after error: Post "https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/LRWYGCEK1PC702540/signed_command": context canceled
llamafilm commented 3 months ago

One thing you could try is validating that your public key matches your private key. To do this, you'll need SSH access to the HAOS host, which you can enable using the SSH port 22222 Configurator. From there, run this command, which should print the same public key as what you see in the browser.

# docker exec -it \
  -e PASSWORD_STORE_DIR=/data/password-store \
  -e GNUPGHOME=/data/gnugpg \
  addon_c03d64a7_tesla_http_proxy /usr/bin/tesla-keygen -keyring-type pass -key-name myself create

If that's fine, you could try reproducing the issue using curl. If you get the same issue that way, it might be a Tesla bug which you can report it here: https://github.com/teslamotors/vehicle-command

Use the Auth For Tesla app to get a new Fleet API refresh token. From inside the homeassistant container:

% curl --cacert /share/tesla/selfsigned.pem \
  --header "Authorization: Bearer $TOKEN \
  --data '{}' \
  https://c03d64a7-tesla-http-proxy/api/1/vehicles/LRWYGCEK1PC702540/command/flash_lights
guidoffm commented 2 months ago

One thing you could try is validating that your public key matches your private key. To do this, you'll need SSH access to the HAOS host, which you can enable using the SSH port 22222 Configurator. From there, run this command, which should print the same public key as what you see in the browser.

# docker exec -it \
  -e PASSWORD_STORE_DIR=/data/password-store \
  -e GNUPGHOME=/data/gnugpg \
  addon_c03d64a7_tesla_http_proxy /usr/bin/tesla \
  -keygen -keyring-type pass -key-name myself create

If that's fine, you could try reproducing the issue using curl. If you get the same issue that way, it might be a Tesla bug which you can report it here: https://github.com/teslamotors/vehicle-command

Use the Auth For Tesla app to get a new Fleet API refresh token. From inside the homeassistant container:

% curl --cacert /share/tesla/selfsigned.pem \
  --header "Authorization: Bearer $TOKEN \
  --data '{}' \
  https://c03d64a7-tesla-http-proxy/api/1/vehicles/LRWYGCEK1PC702540/command/flash_lights

Unfortunately there is no command /usr/bin/tesla in the container.

I can find these commands:

/usr/bin/tesla-http-proxy  /usr/bin/tesla-keygen 
guidoffm commented 2 months ago

When I do a

cat /share/tesla/com.tesla.3p.public-key.pem 
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE9UlGrdzW2rGBhnle0UWr9eKNrxVj
hSiLAOxJaw15yDbadVy6SUmpuhmB1Xk/ImHJgPfk1zj+IQ4BrAdi/AFCvw==
-----END PUBLIC KEY-----

I get a key that does not match my public key. Is that correct?

llamafilm commented 2 months ago

Sorry that was a typo in the line break, I edited my comment just now.

The file at /share/tesla/com.tesla.3p.public-key.pem is supposed to be served by nginx at https://tesla.edvmueller.de/.well-known/appspecific/com.tesla.3p.public-key.pem. If it's not, then I think you need to look at nginx config to see what it's doing.

Since this does not appear to be a bug with the addon, I'm converting it to a discussion.