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 @@
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