teslamateapi icon indicating copy to clipboard operation
teslamateapi copied to clipboard

Ability to use custom API endpoint

Open jlestel opened this issue 1 year ago • 4 comments

As already discussed #255 #292 the official Tesla API will be the only way to send commands.

Using third-party Tesla API providers (or a self-hosted commands proxy) would allow command endpoints to be preserved.

I added an environment variable to allow users to choose their API provider.

jlestel avatar Sep 30 '24 23:09 jlestel

hi @jlestel,

Thanks for your pull request!

Just of curiosity, is this to be able to send the requests through MyTeslamate towards the Fleet API endpoint or what is the goal? I'm considering either removing the commands section from TeslaMateAPI or yeah.. try to change it so that it can be used with the Fleet API directly (even though I don't use the commands endpoints anymore).

Kind regards, Tobias

tobiasehlert avatar Oct 15 '24 20:10 tobiasehlert

Two things regarding this pull request, what do you think?

  1. I prefer use the same environment variable names as used in the TeslaMate project for reusability within the setup (pushed in 5b32d3e).
  2. Would be good to have some info-message at startup that says that the TESLA_API_HOST environment variable is set and therefore is overriding the API command calls.

Other than that it looks good to me :)

Agree on both bullets.

jlestel avatar Oct 17 '24 15:10 jlestel

hi @jlestel,

Thanks for your pull request!

Just of curiosity, is this to be able to send the requests through MyTeslamate towards the Fleet API endpoint or what is the goal? I'm considering either removing the commands section from TeslaMateAPI or yeah.. try to change it so that it can be used with the Fleet API directly (even though I don't use the commands endpoints anymore).

Kind regards, Tobias

no I already send commands via myteslamate. the goal is rather to propose an oss mobile application for teslamate via teslamateapi.

so if it allows users who have their api command to use it to send commands with teslamateapi.

jlestel avatar Oct 17 '24 16:10 jlestel

@jlestel, are you adding the suggestions? I thought about releasing a new version later today/tomorrow :)

tobiasehlert avatar Nov 17 '24 13:11 tobiasehlert

Hi Tobias, I try to improve it tonight

jlestel avatar Nov 17 '24 13:11 jlestel

I changed the env var name. And only if it's set, an info log line display the value of TESLA_API_HOST on launch.

I fixed a typo on the previous line too: https://github.com/tobiasehlert/teslamateapi/pull/307/files#r1845637370

jlestel avatar Nov 17 '24 20:11 jlestel

Hey, thanks for adding this.

I tried using it, and I get:

{
	"error": "Invalid API key: go to app.myteslamate.com/fleet to check it"
}

Is the API_TOKEN environment variable supposed to match the MyTeslamate proxy token value? That's what I am assuming, however I still get the above error.

I'm unable to see the authorisation header sent by TeslamateApi in its logs to check.

johnrogers avatar Oct 26 '25 08:10 johnrogers