-
Notifications
You must be signed in to change notification settings - Fork 22
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
Ability to use custom API endpoint #307
base: main
Are you sure you want to change the base?
Conversation
Quality Gate passedIssues Measures |
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? Kind regards, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things regarding this pull request, what do you think?
- I prefer use the same environment variable names as used in the TeslaMate project for reusability within the setup (pushed in 5b32d3e).
- 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 :)
@@ -122,6 +122,7 @@ Basically the same environment variables for the database, mqqt and timezone nee | |||
| **MQTT_PASSWORD** | string | | | |||
| **MQTT_NAMESPACE** | string | | | |||
| **MQTT_CLIENTID** | string | _4 char random string_ | | |||
| **TESLA_API_URL** | string | _uses Owner API by default_ | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **TESLA_API_URL** | string | _uses Owner API by default_ | | |
| **TESLA_API_HOST** | string | _uses Owner API by default_ | |
@@ -112,9 +112,9 @@ func TeslaMateAPICarsCommandV1(c *gin.Context) { | |||
|
|||
switch getCarRegionAPI(TeslaAccessToken) { | |||
case ChinaAPI: | |||
TeslaEndpointUrl = "https://owner-api.vn.cloud.tesla.cn" | |||
TeslaEndpointUrl = getEnv("TESLA_API_URL", "https://owner-api.vn.cloud.tesla.cn") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TeslaEndpointUrl = getEnv("TESLA_API_URL", "https://owner-api.vn.cloud.tesla.cn") | |
TeslaEndpointUrl = getEnv("TESLA_API_HOST", "https://owner-api.vn.cloud.tesla.cn") |
default: | ||
TeslaEndpointUrl = "https://owner-api.teslamotors.com" | ||
TeslaEndpointUrl = getEnv("TESLA_API_URL", "https://owner-api.teslamotors.com") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TeslaEndpointUrl = getEnv("TESLA_API_URL", "https://owner-api.teslamotors.com") | |
TeslaEndpointUrl = getEnv("TESLA_API_HOST", "https://owner-api.teslamotors.com") |
Agree on both bullets. |
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. |
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.