From 61851455dffbf264eebf0519735dea409c7f2f25 Mon Sep 17 00:00:00 2001 From: Iain Bullock <59146297+iainbullock@users.noreply.github.com> Date: Sun, 7 Apr 2024 15:34:14 +0100 Subject: [PATCH 01/11] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index e479631..d2ab60f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Tesla HTTP Proxy Docker -** Pleae use release version v1.0.3 until I can investigate a problem reported with v1.0.4 (https://github.com/iainbullock/tesla-http-proxy-docker/issues/19). Dockerhub 'latest' tag withdrawn until next release ** - Now tested and working as expected with Home Assistant custom integration https://github.com/alandtse/tesla Originally this was a fork of https://github.com/llamafilm/tesla-http-proxy-addon. All credit to llamafilm (https://github.com/llamafilm) for developing most of this. From c9ac9353943c7fe7e5777258e32157782d560e6b Mon Sep 17 00:00:00 2001 From: Iain Bullock <59146297+iainbullock@users.noreply.github.com> Date: Sun, 7 Apr 2024 15:35:26 +0100 Subject: [PATCH 02/11] Update test.sh --- tesla_http_proxy/app/curl/test.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tesla_http_proxy/app/curl/test.sh b/tesla_http_proxy/app/curl/test.sh index 453df1c..ff7fecd 100644 --- a/tesla_http_proxy/app/curl/test.sh +++ b/tesla_http_proxy/app/curl/test.sh @@ -1,6 +1,5 @@ #!/bin/bash #export TESLA_AUTH_TOKEN=XXXXXXXX -#export VIN=xxxxxxxxxxxxxxxxx curl --cacert ../cert.pem \ --header "Authorization: Bearer $TESLA_AUTH_TOKEN" \ From 84100edd0a412e77d026d3f35c4cc39e7a48cda2 Mon Sep 17 00:00:00 2001 From: Iain Bullock <59146297+iainbullock@users.noreply.github.com> Date: Sun, 7 Apr 2024 15:37:23 +0100 Subject: [PATCH 03/11] Update index.html --- tesla_http_proxy/app/templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tesla_http_proxy/app/templates/index.html b/tesla_http_proxy/app/templates/index.html index 95b180c..aa33c36 100644 --- a/tesla_http_proxy/app/templates/index.html +++ b/tesla_http_proxy/app/templates/index.html @@ -36,7 +36,7 @@

Tesla HTTP Proxy setup

+ (i.e. generate access and refresh tokens. Make sure test 2 works first)
-
From 9034f92614a0cdbf3da31a1d72a9b68ced855021 Mon Sep 17 00:00:00 2001 From: Iain Bullock <59146297+iainbullock@users.noreply.github.com> Date: Sun, 7 Apr 2024 15:44:02 +0100 Subject: [PATCH 05/11] Update index.html --- tesla_http_proxy/app/templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tesla_http_proxy/app/templates/index.html b/tesla_http_proxy/app/templates/index.html index 9b51b12..309673d 100644 --- a/tesla_http_proxy/app/templates/index.html +++ b/tesla_http_proxy/app/templates/index.html @@ -36,7 +36,7 @@

Tesla HTTP Proxy setup

+ (Make sure test 2 works first)
-
From e816e033e795d45ac165fb02bffce1ad327bbef9 Mon Sep 17 00:00:00 2001 From: Iain Bullock <59146297+iainbullock@users.noreply.github.com> Date: Sun, 7 Apr 2024 16:45:19 +0100 Subject: [PATCH 08/11] Update run.sh also check for /data/key.pem --- tesla_http_proxy/app/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tesla_http_proxy/app/run.sh b/tesla_http_proxy/app/run.sh index c252d31..5f40c10 100755 --- a/tesla_http_proxy/app/run.sh +++ b/tesla_http_proxy/app/run.sh @@ -56,7 +56,7 @@ elif [ ! -f /share/nginx/com.tesla.3p.public-key.pem ]; then generate_tesla_keypair fi -if [ -f /share/home-assistant/selfsigned.pem ]; then +if [ -f /share/home-assistant/selfsigned.pem ] && [ -f /data/key.pem ]; then certPubKey="$(openssl x509 -noout -pubkey -in /share/home-assistant/selfsigned.pem)" keyPubKey="$(openssl pkey -pubout -in /data/key.pem)" if [ "${certPubKey}" == "${keyPubKey}" ]; then From 697c927781e0a0b957e935871b70ab24fd0dc9c7 Mon Sep 17 00:00:00 2001 From: Iain Bullock <59146297+iainbullock@users.noreply.github.com> Date: Sun, 7 Apr 2024 17:33:50 +0100 Subject: [PATCH 09/11] Update README.md --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 66fa2fe..91e1053 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,16 @@ Setting this up is fairly complex. Please read [DOCS.md](./tesla_http_proxy/DOC - Return to the 'Tesla HTTP Proxy setup' page. Click the '2. Test public key endpoint' button. This will download the public key (com.tesla.3p.public-key.pem). You don't need to keep the downloaded key. You must keep this accessible to the internet or Tesla will reject your commands made through the proxy. You may have to manually copy the public key to a suitable location in the document root on your webserver. Make sure this test works before proceeding - - Return to the 'Tesla HTTP Proxy setup' page. Click the '3. Register Partner account' button. This generates the Partner Authentication token, and registers the account for API access - - - Return to the 'Tesla HTTP Proxy setup' page. Click the '4. Enroll private key in your vehicle' button. Another Tesla web page will appear inviting you to set up a third party virtual key. There is a QR code which you should scan with your phone (which already has the Tesla App installed and setup for your Tesla account). Approve the key in the Tesla app, which if successful will install it into your vehicle. You can close this webpage + - Return to the 'Tesla HTTP Proxy setup' page. Click the '3. Register Partner account' button. This generates the Partner Authentication token, and registers the account for API access. There isn't any feedback whether this works or not. Check the logs you will see something like this: + +[16:14:02] main:INFO: *** Generating Partner Authentication Token *** +[16:14:03] main:INFO: {"access_token":"LongString","expires_in":28800,"token_type":"Bearer"} +[16:14:03] main:INFO: *** Registering Tesla account *** +[16:14:05] main:INFO: {"response":{"account_id":"XXXX-XXX-XXXX-XXX","domain":"tesla.example.com","name":"TeslaH","description":"Home automation for my Tesla. Application is for personal use only","csr":null,"client_id":"XX-XXXX-XX-XXXXXXXXXX","ca":null,"created_at":"2024-02-28T13:50:49.494Z","updated_at":"2024-04-07T16:14:05.827Z","enterprise_tier":"free","issuer":null,"csr_updated_at":null,"public_key":"FairlyLongString"}} +[16:14:05] werkzeug:INFO: 192.168.1.5 - - [07/Apr/2024 16:14:05] "GET /register-partner-account HTTP/1.0" 302 - +[16:14:05] werkzeug:INFO: 192.168.1.5 - - [07/Apr/2024 16:14:05] "GET /?success=1 HTTP/1.0" 200 - + + - Return to the 'Tesla HTTP Proxy setup' page. Click the '4. Enrol private key in your vehicle' button. Another Tesla web page will appear inviting you to set up a third party virtual key. There is a QR code which you should scan with your phone (which already has the Tesla App installed and setup for your Tesla account). Approve the key in the Tesla app, which if successful will install it into your vehicle. You can close this webpage - Return to the 'Tesla HTTP Proxy setup' page. Click 'Shutdown Flask Server'. This will do as it says. From now on the proxy server will continue to run in the docker contianer and listen for requests From a00003fd9d08e1c4ec0e991bd9587ea3c6a781ca Mon Sep 17 00:00:00 2001 From: Iain Bullock <59146297+iainbullock@users.noreply.github.com> Date: Sun, 7 Apr 2024 17:35:27 +0100 Subject: [PATCH 10/11] Update index.html --- tesla_http_proxy/app/templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tesla_http_proxy/app/templates/index.html b/tesla_http_proxy/app/templates/index.html index f0956dc..cec79f3 100644 --- a/tesla_http_proxy/app/templates/index.html +++ b/tesla_http_proxy/app/templates/index.html @@ -39,7 +39,7 @@

Tesla HTTP Proxy setup

(Make sure test 2 works first)
-
From 2aaf466916f5efbc730edf1a3aa13733ae170799 Mon Sep 17 00:00:00 2001 From: Iain Bullock <59146297+iainbullock@users.noreply.github.com> Date: Sun, 7 Apr 2024 17:36:00 +0100 Subject: [PATCH 11/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 91e1053..228bf89 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Setting this up is fairly complex. Please read [DOCS.md](./tesla_http_proxy/DOC [16:14:05] werkzeug:INFO: 192.168.1.5 - - [07/Apr/2024 16:14:05] "GET /register-partner-account HTTP/1.0" 302 - [16:14:05] werkzeug:INFO: 192.168.1.5 - - [07/Apr/2024 16:14:05] "GET /?success=1 HTTP/1.0" 200 - - - Return to the 'Tesla HTTP Proxy setup' page. Click the '4. Enrol private key in your vehicle' button. Another Tesla web page will appear inviting you to set up a third party virtual key. There is a QR code which you should scan with your phone (which already has the Tesla App installed and setup for your Tesla account). Approve the key in the Tesla app, which if successful will install it into your vehicle. You can close this webpage + - Return to the 'Tesla HTTP Proxy setup' page. Click the '4. Enrol private key into your vehicle' button. Another Tesla web page will appear inviting you to set up a third party virtual key. There is a QR code which you should scan with your phone (which already has the Tesla App installed and setup for your Tesla account). Approve the key in the Tesla app, which if successful will install it into your vehicle. You can close this webpage - Return to the 'Tesla HTTP Proxy setup' page. Click 'Shutdown Flask Server'. This will do as it says. From now on the proxy server will continue to run in the docker contianer and listen for requests