llamafilm / tesla-http-proxy-addon

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

Set up clarification #19

Closed OMVMMG closed 5 months ago

OMVMMG commented 6 months ago

Where do I do this: "Tesla will provide a Client ID and Client Secret. Enter these in addon configuration and then Start it again."

baylanger commented 6 months ago

I believe what you’re looking for is in the Docs

OMVMMG commented 6 months ago

Thanks @baylanger I found what I needed. Any ideas what could be happening here:

[12:15:39] main:INFO: Generating Partner Authentication Token [12:15:39] main:INFO: Registering Tesla account [12:16:40] main:ERROR: Error 504: Gateway Timeout [12:16:40] main:INFO: upstream request timeout

While going through the Generate OAuth token process and after login into my account I get this message for the call back "404: Not Found"

I get an email from Tesla saying that I have granted access to the app but the API refresh token is NOT printed to the log and I cannot enroll the public key.

Any help would be appreciated.

Thank you.

baylanger commented 6 months ago

Any idea why you're getting this error? That's probably the first thing to figure out.

[12:15:39] main:INFO: *** Registering Tesla account ***
[12:16:40] main:ERROR: Error 504: Gateway Timeout
[12:16:40] main:INFO: upstream request timeout

It sure looks like the add-on can't reach Tesla API. Either the API is down, there's routing/firewall issue or something else I can't think off right now.

What's your setup? HAOS or something else? Nginx add-on or?

llamafilm commented 6 months ago

What region did you choose in the config? Make sure you can reach the correct url. https://github.com/llamafilm/tesla-http-proxy-addon/blob/ba9a21593b02c7b93e1f30dd63d45070ee4fe62d/tesla_http_proxy/app/run.py#L21-L23

OMVMMG commented 6 months ago

@llamafilm I chose 'North America, Asia-Pacific': 'https://fleet-api.prd.na.vn.cloud.tesla.com', @baylanger I run HASS OS in a VM. I run Swag in docker but I also installed theNginx add-on as this add-on needs it. Not sure if that might be creating a conflict. The callback is going to https://home.domain.com/callback?locale=en-US and I think it should go to https://tesla.domain.com/callback?locale=en-US where the public key is (correct me if this is wrong)

OMVMMG commented 6 months ago

Is the Nginx add-on meant to just start and stop?

llamafilm commented 6 months ago

I think it should go to https://tesla.domain.com/callback?locale=en-US where the public key is (correct me if this is wrong)

That’s correct. And nginx needs to remain running at all times.

OMVMMG commented 6 months ago

Is there a way to use this add-on without using Nginx in Home Assistant? I already run Nginx (SWAG) outside of Home Assistant.

iainbullock commented 6 months ago

Is there a way to use this add-on without using Nginx in Home Assistant? I already run Nginx (SWAG) outside of Home Assistant.

I am working on a docker version of tesla-http-proxy for those not using Home Assistant Add-ons (e.g. docker version of HA). It works with standalone version of Nginx (i.e. not using the Nginx add on in HA).

Note it's work in progress. It can send commands to the car with curl so it should be possible to work with https://github.com/alandtse/tesla (I will work on this over the next few days to make whatever adjustments are needed since v3.20.1 was just released)

https://github.com/iainbullock/tesla-http-proxy-docker

If you can install HA addons then you can use llamafilm's version with a standalone Nginx setup. Nginx configuration would be something like this https://github.com/iainbullock/tesla-http-proxy-docker/blob/main/nginx_tesla.conf You have to put the file com.tesla.3p.public-key.pem created by the add on into the document root

OMVMMG commented 6 months ago

@iainbullock Thank you for this. I was away and I just noticed it. I'll follow the intructions and hopefully get it done