-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CURL request returns error #17
Comments
Per the logs, this is probably the name to use otherwise I also get Could not resolve host.
I found the token in the addon. The below command will set the variable:
But when running the curl, in my case I get |
You are probably using the "Terminal & SSH" add-on. Stop it and disable "Show in sidebar" then install the "Advanced SSH & Web Terminal" add-on. Make sure "Protection mode" is disable. |
It finally works! I can get answer from docker command, store the token in the TESLA_AUTH_TOKEN and now I got answer to CURL request. I think it is worth to include the following steps in the guideline:
|
I don't know how a add-on hostname is assigned but it looks like the hostname is the change on all installations... is it? I have a PR to update the docs and earlier change the hostname to add c03d64a but that was before figured out, as you mentioned, the hostname is actually listed on the first page of the add-on. I'll add a note in the docs to tell people where to get it in case it's not the same or changes in future HA releases. |
About the docker command to get the access token, there might be another way to get it. If so, I'm not sure how. Perhaps it can be exposed in the add-on settings like a "static value" or allow to be fetched via a different url from HA? @llamafilm Do you also go into the docker instance to get the token? |
I never use the access token because it expires after a few hours. I just enter the refresh token into the Tesla component and it takes care of all the refreshing. Another way to get an access token is by POSTing a refresh request. I don't expect regular users to use curl commands, so I'll move this section to DEVELOPERS.md. I like your docker exec command so I'll include that too. |
I didn't "manually" installed the integration with your changes, that now explains why my token had expired... I did a Restart of the add-on hoping it would refresh it but it started Flask. I just installed earlier the latest add-on released just earlier and now it didn't start Flask. I didn't see in the release note a fix for this but noticed you open an issue with hassio maybe related to this. Was this fixed or it's my imagination :) ? Thanx and welcome for the docker command. |
If you installed version 1.3.0 that one is broken. I fixed it in 1.3.1. Flask should run each time as long as the regenerate_auth setting is enabled. When you click the restart button in the addon web UI it disables that setting and restarts to the proxy. |
@llamafilm How can I install your tesla component? I have the "official" one that is able only to read data. If I can use with your proxy would be great. How I can do without messing up everything? |
@paky79 this is the Tesla integration but there's a PR in progress. I think it's better we let them focus on finishing that work so everyone can benefit. If you look around there were instructions posted how to do it, but it's a hack. If you really need to remotely control your car "now", example due to solar integrations, look for the instructions otherwise just be patient. In my case, I can wait. |
Hello,
after the successfully setup of Tesla dev account I run through the different steps:
- Generate OAuth Token: following what I see in my log:
[13:09:21] INFO: Found existing keypair
[13:09:21] NOTICE: Starting temporary Python app for authentication flow
[13:09:22] main:INFO: *** Generating Partner Authentication Token ***
[13:09:22] main:INFO: *** Registering Tesla account ***
[13:09:24] main:INFO: {"response":{"account_id":"ab546ecc-0bef-498a-aa34-48d38b908359","domain":"teslamypaky.duckdns.org","name":"Remote connection of MY car","description":"Remote connection of MY car","csr":null,"client_id":"b638e746dd7b-4384-b4cc-c4bdc57b5422","ca":null,"created_at":"2024-03-05T20:41:52.524Z","updated_at":"2024-03-05T20:41:52.524Z","enterprise_tier":"free","issuer":null,"csr_updated_at":null,"public_key":"049e808a1edbb74f06c0fb3ca77bc5330ff0972fe23ac83a808d526b29c7b7148f3e91d0173a87740d342f7292a1159deffc7d3bfcede8af788dab149bf67ed8a6"}}
[13:09:24] main:INFO: *** Starting Flask server... ***
[13:09:24] werkzeug:INFO: WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
[13:09:24] werkzeug:INFO: Press CTRL+C to quit
[13:09:26] werkzeug:INFO: 172.30.32.2 - - [06/Mar/2024 13:09:26] "GET / HTTP/1.1" 200 -
[13:09:50] run:WARNING: Info to enter into Tesla Custom component:
Refresh token : EU_47b00cd9864e8b9f2b1126c0e26cf53bf02a70e6535f4245a51252c7db24f0f9
Proxy URL : https://c03d64a7-tesla-http-proxy
SSL certificate: /share/tesla/selfsigned.pem
Client ID : b638e746dd7b-4384-b4cc-c4bdc57b5422
[13:09:50] werkzeug:INFO: 172.30.33.5 - - [06/Mar/2024 13:09:50] "GET /callback?locale=en-US&code=EU_bf4162502c39dcceb3fc4b8963294973fd33979cbc53e56f5319dc327ef1&state=71ca2d28a47a4436bb59c14498db6354&issuer=https://auth.tesla.com/oauth2/v3 HTTP/1.0" 200 -
[13:09:51] run:ERROR: 'refresh_token'
[13:09:51] werkzeug:INFO: 172.30.33.5 - - [06/Mar/2024 13:09:51] "GET /callback?locale=en-US&code=EU_bf4162502c39dcceb3fc4b8963294973fd33979cbc53e56f5319dc327ef1&state=71ca2d28a47a4436bb59c14498db6354&issuer=https://auth.tesla.com/oauth2/v3 HTTP/1.0" 500 -
- Successfully Enrolled public key in your vehicle;
- I tested the public key and check that result was fine
- At the end I tried to run the following:
curl --cacert /share/tesla/selfsigned.pem
--header "Authorization: Bearer $TESLA_AUTH_TOKEN"
"https://addon-tesla-http-proxy/api/1/vehicles"
I set TESLA_AUTH_TOKEN=refresh_token (EU_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx). Is it right or should be something else?
The request fails every time with the following error:
curl: (6) Could not resolve host: addon-tesla-http-proxy
I check the addon log and I don't find any issue:
[14:27:01] werkzeug:INFO: 172.30.32.2 - - [06/Mar/2024 14:27:01] "GET / HTTP/1.1" 200 -
[14:27:04] 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-03-06T14:27:04+01:00 [debug] Creating proxy
2024-03-06T14:27:04+01:00 [info ] Listening on 0.0.0.0:443
Do you have any idea what is the issue?
The text was updated successfully, but these errors were encountered: