-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Provide steps for Tesla Fleet API 2025 update. #36725
Provide steps for Tesla Fleet API 2025 update. #36725
Conversation
✅ Deploy Preview for home-assistant-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe changes to the Changes
Sequence DiagramsequenceDiagram
participant User
participant "Home Assistant"
participant "Tesla Fleet API"
participant "Developer Portal"
User->>Developer Portal: Register Application
Developer Portal-->>User: Provide Client Credentials
User->>User: Generate Public/Private Key Pair
User->>User: Host Public Key on Domain
User->>Home Assistant: Configure Tesla Fleet Integration
Home Assistant->>Tesla Fleet API: Request Access Token
Tesla Fleet API-->>Home Assistant: Authenticate and Authorize
Home Assistant-->>User: Integration Successful
This sequence diagram illustrates the high-level process of setting up the Tesla Fleet API integration, from application registration to successful authentication in Home Assistant. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
🧹 Nitpick comments (2)
source/_integrations/tesla_fleet.markdown (2)
330-347
: Enhance troubleshooting section with billing-related issuesThe troubleshooting section should include guidance for billing-related issues, especially given the new API pricing model.
Add a new troubleshooting item:
- **Integration no longer works after the January 2025 API pricing updates** 1. Refer to the '**Integration is broken**' troubleshooting steps above. +- **Integration shows rate limit or billing errors** + 1. Check your current billing usage in the Tesla Developer Dashboard under the '**Application Usage**' tab. + 2. If you've exceeded the free credit limit, ensure your billing details are up to date. + 3. Consider adjusting the integration's update frequency to reduce API calls if needed. + - **Integration shows `a condition has not been met to process the request`**
46-46
: Clarify web domain requirementsThe requirement for a "privately-owned web domain" might be unclear to some users.
Expand the explanation:
-A privately-owned web domain where you can host your public key file without needing to rely on redirects. Simple file-hosting services such as AWS S3 may help with this for free/cheap. +A web domain that you control (e.g., example.com) where you can host files directly without URL redirects. This can be: +- A domain you already own and host +- A new domain with simple file hosting (e.g., using AWS S3, GitHub Pages) +- A subdomain of your existing domain +The domain must support HTTPS and allow direct file access at the specified path.🧰 Tools
🪛 LanguageTool
[uncategorized] ~46-~46: Although a hyphen is possible, it is not necessary in a compound modifier in which the first word is an adverb that ends in ‘ly’.
Context: ...eveloper.tesla.com/en_US/dashboard) - A privately-owned web domain where you can host your publ...(HYPHENATED_LY_ADVERB_ADJECTIVE)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/tesla_fleet.markdown
(2 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/tesla_fleet.markdown
[uncategorized] ~46-~46: Although a hyphen is possible, it is not necessary in a compound modifier in which the first word is an adverb that ends in ‘ly’.
Context: ...eveloper.tesla.com/en_US/dashboard) - A privately-owned web domain where you can host your publ...
(HYPHENATED_LY_ADVERB_ADJECTIVE)
[grammar] ~65-~65: The verb ‘recommended’ is used with the gerund form.
Context: ...i#step-2-create-an-application), but it recommended to follow the steps below to cover specific detai...
(ADMIT_ENJOY_VB)
[style] ~65-~65: This phrase is redundant. Consider writing “details”.
Context: ...nded to follow the steps below to cover specific details. 1. If you have not already, set up yo...
(SPECIFIC_DETAILS)
[misspelling] ~67-~67: This word is normally spelled as one.
Context: ...firm that you have a verified email and multi-factor authentication set up. 2. Navigate to t...
(EN_COMPOUNDS_MULTI_FACTOR)
[grammar] ~68-~68: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the top-right corner”?
Context: ... account is based, using the globe icon at the top-right corner. 3. Click 'Create New Application'....
(ON_IN_THE_CORNER_2)
[style] ~134-~134: Consider removing “of” to be more concise
Context: ...izard. The integration will ask you for all of the necessary integration configuration. 3....
(ALL_OF_THE)
🪛 Markdownlint (0.37.0)
source/_integrations/tesla_fleet.markdown
149-149: Expected: 0 or 2; Actual: 1
Trailing spaces
(MD009, no-trailing-spaces)
149-149: Column: 1
Hard tabs
(MD010, no-hard-tabs)
143-143: Expected: 1; Actual: 2
Multiple consecutive blank lines
(MD012, no-multiple-blanks)
93-93: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
105-105: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
111-111: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
113-113: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
116-116: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
123-123: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
44-44: null
Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
93-93: null
Fenced code blocks should have a language specified
(MD040, fenced-code-language)
111-111: null
Fenced code blocks should have a language specified
(MD040, fenced-code-language)
116-116: null
Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🪛 Gitleaks (8.21.2)
source/_integrations/tesla_fleet.markdown
117-119:
(curl-auth-header)
🪛 GitHub Actions: home-assistant.io Test
source/_integrations/tesla_fleet.markdown
[warning] 93-105: Unexpected missing fenced code language flag in info string, expected keyword
[warning] 111-113: Unexpected missing fenced code language flag in info string, expected keyword
[warning] 116-123: Unexpected missing fenced code language flag in info string, expected keyword
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.
Actionable comments posted: 1
🧹 Nitpick comments (4)
source/_integrations/tesla_fleet.markdown (4)
43-46
: Add clarification about domain requirements.The prerequisites section should be more specific about the domain requirements to help users prepare correctly.
- A web domain that you own and can host your public key file directly onto without needing to rely on URL redirects. Simple file-hosting services such as AWS S3 may help with this for free/cheap. +- A web domain that you own and control, with HTTPS enabled, where you can host static files. The domain must serve files directly without URL redirects. Examples of suitable hosting: + - AWS S3 with static website hosting + - GitHub Pages + - Netlify🧰 Tools
🪛 Markdownlint (0.37.0)
44-44: null
Lists should be surrounded by blank lines(MD032, blanks-around-lists)
151-165
: Enhance the pay-per-use section with cost examples.The pricing information would be more helpful with concrete examples.
Previously, Tesla restricted this integration to a very modest rate limit. However, from January 2025, accounts in eligible countries will be charged for every API call. Here's what you need to know: - Tesla provides a $10 credit per developer account per calendar month - Every vehicle coordinator refresh, vehicle command, and wake up has a cost - This credit only allows for a maximum of 5000 coordinator refreshes - Energy product APIs are free to use at this time - To go beyond the free credit, you must provide payment details to Tesla + +Example costs: +- Vehicle coordinator refresh: $0.002 per call +- Vehicle command (lock/unlock, climate control, etc.): $0.02 per command +- Vehicle wake up: $0.02 per wake up + +With the default polling interval, a single vehicle might use: +- ~720 coordinator refreshes per day ($1.44/day) +- ~21,600 coordinator refreshes per month ($43.20/month) + +Consider adjusting the polling interval based on your usage patterns and budget.🧰 Tools
🪛 Markdownlint (0.37.0)
154-154: Expected: 0 or 2; Actual: 1
Trailing spaces(MD009, no-trailing-spaces)
154-154: Column: 1
Hard tabs(MD010, no-hard-tabs)
337-340
: Expand general troubleshooting steps.The troubleshooting section could be more detailed about common issues.
- **General troubleshooting steps** 1. Confirm that your vehicle or energy product can be accessed and updates within the official Tesla app. This rules out any issues that are outside the control of Home Assistant or this integration. 2. For some errors in the integration, waking the vehicle or energy product through the official app, then restarting Home Assistant will sometimes help re-authenticate the connection with Tesla's API. You may be asked to re-authenticate through the Tesla website. + 3. Check the Home Assistant logs for specific error messages: + - "Invalid credentials": Re-authenticate through the Tesla website + - "Vehicle unavailable": Wake the vehicle through the Tesla app + - "Rate limit exceeded": Review your API usage and billing status + 4. Verify your network connectivity: + - Ensure stable internet connection + - Check if your firewall is blocking API calls + - Verify DNS resolution for Tesla API endpoints
347-349
: Enhance the 2025 API pricing update section.The troubleshooting section for the 2025 API pricing update could be more specific.
- **Integration no longer works after the January 2025 API pricing updates** 1. Refer to the '**Integration is broken**' troubleshooting steps above. + 2. Check your Tesla Developer Dashboard for: + - Current API usage and billing status + - Any payment method issues + - Remaining monthly credit + 3. Consider adjusting the integration's polling frequency if you're exceeding the free tier: + - Increase the scan interval + - Disable non-essential entities + - Use automation triggers instead of polling where possible
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/tesla_fleet.markdown
(2 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/tesla_fleet.markdown
[grammar] ~65-~65: The verb ‘recommended’ is used with the gerund form.
Context: ...i#step-2-create-an-application), but it recommended to follow the steps below to cover specific detai...
(ADMIT_ENJOY_VB)
[style] ~65-~65: This phrase is redundant. Consider writing “details”.
Context: ...nded to follow the steps below to cover specific details. 1. If you have not already, set up yo...
(SPECIFIC_DETAILS)
[misspelling] ~67-~67: This word is normally spelled as one.
Context: ...firm that you have a verified email and multi-factor authentication set up. 2. Navigate to t...
(EN_COMPOUNDS_MULTI_FACTOR)
[grammar] ~68-~68: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the top-right corner”?
Context: ... account is based, using the globe icon at the top-right corner. 3. Click 'Create New Application'....
(ON_IN_THE_CORNER_2)
[style] ~139-~139: Consider removing “of” to be more concise
Context: ...izard. The integration will ask you for all of the necessary integration configuration. 3....
(ALL_OF_THE)
🪛 Markdownlint (0.37.0)
source/_integrations/tesla_fleet.markdown
154-154: Expected: 0 or 2; Actual: 1
Trailing spaces
(MD009, no-trailing-spaces)
154-154: Column: 1
Hard tabs
(MD010, no-hard-tabs)
148-148: Expected: 1; Actual: 2
Multiple consecutive blank lines
(MD012, no-multiple-blanks)
98-98: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
110-110: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
116-116: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
118-118: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
121-121: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
128-128: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
44-44: null
Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
🪛 Gitleaks (8.21.2)
source/_integrations/tesla_fleet.markdown
122-124:
(curl-auth-header)
🔇 Additional comments (2)
source/_integrations/tesla_fleet.markdown (2)
91-93
: Security warning is properly placed.Good practice to include a security warning before sharing sensitive credential handling steps.
98-110
: Code blocks are properly formatted with language specifications.The shell and JSON code blocks are correctly specified with their respective language identifiers.
Also applies to: 116-118, 121-128
🧰 Tools
🪛 Markdownlint (0.37.0)
98-98: null
Fenced code blocks should be surrounded by blank lines(MD031, blanks-around-fences)
110-110: null
Fenced code blocks should be surrounded by blank lines(MD031, blanks-around-fences)
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.
Actionable comments posted: 0
🧹 Nitpick comments (4)
source/_integrations/tesla_fleet.markdown (4)
46-46
: Enhance domain hosting prerequisite clarity.Consider providing more specific guidance about domain requirements and potential costs:
-A web domain that you own and can host your public key file directly onto without needing to rely on URL redirects. Simple file-hosting services such as AWS S3 may help with this for free/cheap. +A web domain that you own and can host your public key file directly onto without URL redirects. Examples of suitable hosting options: +- AWS S3 (free tier available) +- GitHub Pages (free) +- Netlify (free tier available) +Note: The domain must support HTTPS and allow direct file access.
156-162
: Add specific cost examples for common usage patterns.The pricing section would be more helpful with concrete examples:
- Tesla provides a $10 credit per developer account per calendar month - Every vehicle coordinator refresh, vehicle command, and wake up has a cost - This credit only allows for a maximum of 5000 coordinator refreshes - Energy product APIs are free to use at this time - To go beyond the free credit, you must provide payment details to Tesla + +Example usage costs: +- Polling vehicle status every 5 minutes: ~8,640 refreshes/month +- Sending a command (lock/unlock): X credits per command +- Waking up vehicle: Y credits per wake-up
337-352
: Expand troubleshooting section with common error messages.Consider adding specific error messages and their solutions:
- **General troubleshooting steps** 1. Confirm that your vehicle or energy product can be accessed and updates within the official Tesla app. This rules out any issues that are outside the control of Home Assistant or this integration. 2. For some errors in the integration, waking the vehicle or energy product through the official app, then restarting Home Assistant will sometimes help re-authenticate the connection with Tesla's API. You may be asked to re-authenticate through the Tesla website. + +Common error messages and solutions: +- "Invalid client credentials": Re-check your Client ID and Client Secret. +- "Token expired": Re-authenticate through the Tesla website. +- "Vehicle unavailable": Wake the vehicle through the Tesla app.
65-65
: Fix grammatical and style issues.Address the following language improvements:
-These steps are also summarized in the [Tesla Fleet API documentation Step 2](https://developer.tesla.com/docs/fleet-api/getting-started/what-is-fleet-api#step-2-create-an-application), but it is recommended to follow the steps below to cover specific details. +These steps are also summarized in the [Tesla Fleet API documentation Step 2](https://developer.tesla.com/docs/fleet-api/getting-started/what-is-fleet-api#step-2-create-an-application), but it is recommended to follow the steps below for detailed guidance. -Navigate to the [Developer dashboard](https://developer.tesla.com/en_US/dashboard). Change your locale if needed to wherever your account is based, using the globe icon at the top-right corner. +Navigate to the [Developer dashboard](https://developer.tesla.com/en_US/dashboard). Change your locale if needed to wherever your account is based, using the globe icon in the top-right corner. -The integration wizard should walk you through the default steps. If not already started, scroll above and click the '**ADD INTEGRATION TO MY**' button to start the integration wizard. The integration will ask you for all of the necessary integration configuration. +The integration wizard should walk you through the default steps. If not already started, scroll above and click the '**ADD INTEGRATION TO MY**' button to start the integration wizard. The integration will ask you for all necessary configuration details.Also applies to: 68-68, 139-139
🧰 Tools
🪛 LanguageTool
[style] ~65-~65: This phrase is redundant. Consider writing “details”.
Context: ...nded to follow the steps below to cover specific details. 1. If you have not already, set up yo...(SPECIFIC_DETAILS)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/tesla_fleet.markdown
(2 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/tesla_fleet.markdown
[style] ~65-~65: This phrase is redundant. Consider writing “details”.
Context: ...nded to follow the steps below to cover specific details. 1. If you have not already, set up yo...
(SPECIFIC_DETAILS)
[misspelling] ~67-~67: This word is normally spelled as one.
Context: ...firm that you have a verified email and multi-factor authentication set up. 2. Navigate to t...
(EN_COMPOUNDS_MULTI_FACTOR)
[grammar] ~68-~68: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the top-right corner”?
Context: ... account is based, using the globe icon at the top-right corner. 3. Click 'Create New Application'....
(ON_IN_THE_CORNER_2)
[style] ~139-~139: Consider removing “of” to be more concise
Context: ...izard. The integration will ask you for all of the necessary integration configuration. 3....
(ALL_OF_THE)
🪛 Markdownlint (0.37.0)
source/_integrations/tesla_fleet.markdown
154-154: Expected: 0 or 2; Actual: 1
Trailing spaces
(MD009, no-trailing-spaces)
154-154: Column: 1
Hard tabs
(MD010, no-hard-tabs)
148-148: Expected: 1; Actual: 2
Multiple consecutive blank lines
(MD012, no-multiple-blanks)
98-98: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
110-110: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
116-116: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
118-118: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
121-121: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
128-128: null
Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
44-44: null
Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
🪛 Gitleaks (8.21.2)
source/_integrations/tesla_fleet.markdown
122-124:
(curl-auth-header)
Hey there @Bre77, mind taking a look at this feedback as it has been labeled with an integration ( Code owner commandsCode owners of
|
Should also include guidance around the use of EU URL's for non-US/Asia users. |
Some extra nuance, the billing step will not show up for all users, as Tesla isn't billing all countries yet. Otherwise it looks great. |
…t/home-assistant.io into clarify-tesla-fleet-integration-1
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.
Actionable comments posted: 1
🧹 Nitpick comments (5)
source/_integrations/tesla_fleet.markdown (5)
55-60
: Add backup recommendations for private key.While the instructions mention backing up the keys somewhere safe, it would be helpful to provide specific recommendations for secure key storage.
5. Backup both these files somewhere safe and private for access later. + - Store the private key in a password manager or encrypted storage + - Never share or expose your private key + - Consider creating a backup copy on an encrypted USB drive
78-79
: Clarify the impact of scope selection.The documentation should explain the functionality limitations when only selecting minimal scopes.
- At least one of `Vehicle Information` or `Energy Product Information` **must** be selected for the integration to function. It is recommended you select all scopes for full functionality. + - Selecting only `Vehicle Information` will limit access to vehicle-related features only + - Selecting only `Energy Product Information` will limit access to Powerwall and solar features only - If you're unsure, you can select only one of these two required scopes for now and update the scopes later from the Developer Dashboard. However, note that if the scopes are updated, you will need to reconfigure the integration fully (refer to the '**Integration is broken and needs to be reconfigured**' troubleshooting steps below).
163-168
: Add cost calculation example.The pay-per-use section would benefit from a concrete example of cost calculation.
- Tesla provides a $10 credit per developer account per calendar month - Every vehicle coordinator refresh, vehicle command, and wake up has a cost - This credit only allows for a maximum of 5000 coordinator refreshes - Energy product APIs are free to use at this time - To go beyond the free credit, you must provide payment details to Tesla + +For example: +- Each coordinator refresh costs $0.002 +- With 5000 refreshes per month (approximately 1 refresh every 9 minutes) +- Total cost: $10 (covered by the monthly credit)
347-351
: Add note about data persistence.Users should be informed about what happens to their existing device configurations when reconfiguring.
2. Go to your Tesla Fleet integration page in Home Assistant, then click the '**RECONFIGURE**' button to bring the integration wizard up. - If the '**RECONFIGURE**' button is not visible, clear any Application Credentials related to Tesla Fleet from your Application Credentials page (can be found at `http://homeassistant.local:PORT/config/application_credentials`), then restart Home Assistant. After the restart, navigate to the Tesla Fleet integration page and the '**RECONFIGURE**' button should be visible. + - Note: Reconfiguring the integration will preserve your existing device configurations and customizations
69-69
: Fix preposition in UI navigation instruction.-using the globe icon at the top-right corner +using the globe icon in the top-right corner🧰 Tools
🪛 LanguageTool
[grammar] ~69-~69: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the top-right corner”?
Context: ... account is based, using the globe icon at the top-right corner. 3. Click 'Create New Application'....(ON_IN_THE_CORNER_2)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/tesla_fleet.markdown
(2 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/tesla_fleet.markdown
[style] ~66-~66: This phrase is redundant. Consider writing “details”.
Context: ...nded to follow the steps below to cover specific details. 1. If you have not already, set up yo...
(SPECIFIC_DETAILS)
[misspelling] ~68-~68: This word is normally spelled as one.
Context: ...firm that you have a verified email and multi-factor authentication set up. 2. Navigate to t...
(EN_COMPOUNDS_MULTI_FACTOR)
[grammar] ~69-~69: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the top-right corner”?
Context: ... account is based, using the globe icon at the top-right corner. 3. Click 'Create New Application'....
(ON_IN_THE_CORNER_2)
[style] ~146-~146: Consider removing “of” to be more concise
Context: ...izard. The integration will ask you for all of the necessary integration configuration. 3....
(ALL_OF_THE)
🪛 Gitleaks (8.21.2)
source/_integrations/tesla_fleet.markdown
128-130:
(curl-auth-header)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - home-assistant-docs
- GitHub Check: Header rules - home-assistant-docs
- GitHub Check: Pages changed - home-assistant-docs
🔇 Additional comments (2)
source/_integrations/tesla_fleet.markdown (2)
43-47
: LGTM! Clear prerequisites section.The prerequisites are well-structured and clearly state the requirements, including the important detail about needing a web domain that can host files without redirects.
343-345
: LGTM! Clear troubleshooting steps.The troubleshooting section provides clear, actionable steps and properly sets expectations by recommending verification through the official Tesla app first.
@Bre77 Details added, and ready for review. Let me know what you think please. Thanks! |
```shell | ||
CLIENT_ID=REPLACE_THIS_WITH_YOUR_CLIENT_ID | ||
CLIENT_SECRET=REPLACE_THIS_WITH_YOUR_CLIENT_SECRET | ||
AUDIENCE="https://fleet-api.prd.na.vn.cloud.tesla.com" | ||
curl --request POST \ | ||
--header 'Content-Type: application/x-www-form-urlencoded' \ | ||
--data-urlencode 'grant_type=client_credentials' \ | ||
--data-urlencode "client_id=$CLIENT_ID" \ | ||
--data-urlencode "client_secret=$CLIENT_SECRET" \ | ||
--data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \ | ||
--data-urlencode "audience=$AUDIENCE" \ | ||
'https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3/token' | ||
``` |
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.
We need to cover EU here too, and the NA domain looks wrong.
```shell | |
CLIENT_ID=REPLACE_THIS_WITH_YOUR_CLIENT_ID | |
CLIENT_SECRET=REPLACE_THIS_WITH_YOUR_CLIENT_SECRET | |
AUDIENCE="https://fleet-api.prd.na.vn.cloud.tesla.com" | |
curl --request POST \ | |
--header 'Content-Type: application/x-www-form-urlencoded' \ | |
--data-urlencode 'grant_type=client_credentials' \ | |
--data-urlencode "client_id=$CLIENT_ID" \ | |
--data-urlencode "client_secret=$CLIENT_SECRET" \ | |
--data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \ | |
--data-urlencode "audience=$AUDIENCE" \ | |
'https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3/token' | |
``` | |
```shell | |
CLIENT_ID=REPLACE_THIS_WITH_YOUR_CLIENT_ID | |
CLIENT_SECRET=REPLACE_THIS_WITH_YOUR_CLIENT_SECRET | |
#AUDIENCE="https://fleet-api.prd.na.vn.cloud.tesla.com" | |
#AUDIENCE="https://fleet-api.prd.eu.vn.cloud.tesla.com" | |
#AUDIENCE="https://fleet-api.prd.cn.vn.cloud.tesla.com" | |
curl --request POST \ | |
--header 'Content-Type: application/x-www-form-urlencoded' \ | |
--data-urlencode 'grant_type=client_credentials' \ | |
--data-urlencode "client_id=$CLIENT_ID" \ | |
--data-urlencode "client_secret=$CLIENT_SECRET" \ | |
--data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \ | |
--data-urlencode "audience=$AUDIENCE" \ | |
'https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3/token' | |
``` |
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.
@Bre77 Thanks for the suggestions.
-
I just verified the NA domain, and it looks correct. It appears unchanged in your suggestion too. Any idea what I may be missing?
-
There is already a line immediately below this section mentioning:
Replace the `AUDIENCE` value with your region-specific URL. The URL in the example is for users in North America and Asia-Pacific (excluding China). Refer to the [Base URLs documentation](https://developer.tesla.com/docs/fleet-api/getting-started/base-urls) for the URLs for other regions.
If we're instead expanding each region-specific curl command, shall I
- also add the China URL in a similar but separate section? The Asia-Pacific URL excludes China.
- abbreviate the line referencing the Tesla docs to something like Refer to the [Base URLs documentation](https://developer.tesla.com/docs/fleet-api/getting-started/base-urls) for more info.
, omitting the direction to replace the AUDIENCE
value?
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.
Oh I have made a mistake, the curl address is not region specific, I thought it was. Yes if you can condense this down to a single example that would be better, I just couldnt think of a great way to clearly communicate that.
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.
Sounds good. Does the single example that I've added suffice, along with the note after it to swap the AUDIENCE
value to the correct URL (also provides links to where to find the region URLs)?
Co-authored-by: Brett Adams <[email protected]>
Co-authored-by: Brett Adams <[email protected]>
Co-authored-by: Brett Adams <[email protected]>
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.
Actionable comments posted: 0
🧹 Nitpick comments (5)
source/_integrations/tesla_fleet.markdown (5)
56-67
: Add security best practices for private key handling.While the instructions are clear, consider adding a security note about private key protection:
4. Rename the public key file to `com.tesla.3p.public-key.pem`. This needs to be exactly this for Tesla's API to partner with your account correctly. -5. Backup both these files somewhere safe and private for access later. +5. Store your private key securely: + - Keep it in a secure, encrypted location + - Never share it or commit it to version control + - Backup both files somewhere safe and private for access later 6. Upload the public key file to your domain...
71-71
: Fix redundant phrasing.-These steps are also summarized in the [Tesla Fleet API documentation Step 2](https://developer.tesla.com/docs/fleet-api/getting-started/what-is-fleet-api#step-2-create-an-application), but it is recommended to follow the steps below to cover specific details. +These steps are also summarized in the [Tesla Fleet API documentation Step 2](https://developer.tesla.com/docs/fleet-api/getting-started/what-is-fleet-api#step-2-create-an-application), but it is recommended to follow the steps below for detailed coverage.🧰 Tools
🪛 LanguageTool
[style] ~71-~71: This phrase is redundant. Consider writing “details”.
Context: ...nded to follow the steps below to cover specific details. 1. If you have not already, set up yo...(SPECIFIC_DETAILS)
105-117
: Add error handling guidance for curl commands.Consider adding common error responses and troubleshooting steps:
```shell CLIENT_ID=REPLACE_THIS_WITH_YOUR_CLIENT_ID CLIENT_SECRET=REPLACE_THIS_WITH_YOUR_CLIENT_SECRET AUDIENCE="https://fleet-api.prd.na.vn.cloud.tesla.com" curl --request POST \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode "client_id=$CLIENT_ID" \ --data-urlencode "client_secret=$CLIENT_SECRET" \ --data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \ --data-urlencode "audience=$AUDIENCE" \ 'https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3/token'
- Common errors and solutions:
{"error":"invalid_client"}
: Double-check your Client ID and Secret
{"error":"invalid_scope"}
: Verify the scopes match those in your developer application
- Connection timeout: Ensure you're using the correct regional endpoint
--- `165-176`: **Add a cost calculation example.** Consider adding a practical example to help users estimate their costs: ```diff - Tesla provides a $10 credit per developer account per calendar month - Every vehicle coordinator refresh, vehicle command, and wake up has a cost - This credit only allows for a maximum of 5000 coordinator refreshes - Energy product APIs are free to use at this time - To go beyond the free credit, you must provide payment details to Tesla + +Example cost calculation: +- Coordinator refresh every 5 minutes = 8,640 refreshes per month +- Cost per refresh = $0.002 +- Monthly cost = $17.28 ($7.28 after free credit)
346-363
: Add logging information for troubleshooting.Consider adding guidance about checking logs:
- **General troubleshooting steps** 1. Confirm that your vehicle or energy product can be accessed and updates within the official Tesla app. This rules out any issues that are outside the control of Home Assistant or this integration. 2. For some errors in the integration, waking the vehicle or energy product through the official app, then restarting Home Assistant will sometimes help re-authenticate the connection with Tesla's API. You may be asked to re-authenticate through the Tesla website. + 3. Check the Home Assistant logs for detailed error messages: + - Navigate to Configuration > Logs + - Filter for "tesla_fleet" to see integration-specific logs + - Look for error messages or authentication failures
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/tesla_fleet.markdown
(2 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/tesla_fleet.markdown
[style] ~71-~71: This phrase is redundant. Consider writing “details”.
Context: ...nded to follow the steps below to cover specific details. 1. If you have not already, set up yo...
(SPECIFIC_DETAILS)
[misspelling] ~73-~73: This word is normally spelled as one.
Context: ...firm that you have a verified email and multi-factor authentication set up. 2. Navigate to t...
(EN_COMPOUNDS_MULTI_FACTOR)
[grammar] ~74-~74: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the top-right corner”?
Context: ... account is based, using the globe icon at the top-right corner. 3. Click 'Create New Application'....
(ON_IN_THE_CORNER_2)
[style] ~151-~151: Consider removing “of” to be more concise
Context: ...izard. The integration will ask you for all of the necessary integration configuration. 3....
(ALL_OF_THE)
🪛 Markdownlint (0.37.0)
source/_integrations/tesla_fleet.markdown
53-53: Expected: 1; Actual: 2
Multiple consecutive blank lines
(MD012, no-multiple-blanks)
🪛 Gitleaks (8.21.2)
source/_integrations/tesla_fleet.markdown
133-135:
(curl-auth-header)
🔇 Additional comments (2)
source/_integrations/tesla_fleet.markdown (2)
43-52
: LGTM! Well-structured prerequisites section.The prerequisites are clearly listed with multiple hosting options, making it easier for users to get started.
148-158
: LGTM! Clear integration setup instructions.The Home Assistant linking steps are well-documented and easy to follow.
🧰 Tools
🪛 LanguageTool
[style] ~151-~151: Consider removing “of” to be more concise
Context: ...izard. The integration will ask you for all of the necessary integration configuration. 3....(ALL_OF_THE)
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.
I am happy to get this in as is and we can take further input and feedback to refine it further.
Thanks, @Bre77 ! I appreciate the assist on these changes. And let me know if I can help with testing any upcoming Tesla integration updates 🙂 |
- A web domain and host that you can serve your public key file from. Some free options include: | ||
- [FleetKey.cc](https://fleetkey.cc) | ||
- [AWS S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html) | ||
- [Cloudflare Pages](https://pages.cloudflare.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.
For what it's worth, I was able to use Cloudflare R2 to host my public key, which was simpler to set up.
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.
This is the problem with listing options, there are so many that could be there. I personally just want to push fleetkey.cc since that seems to be really helping people without the technical knowledge to do it themselves.
@Bre77 My apologies for being squeaky. Thanks for approving the PR again. I see |
We have to wait for a core team member to approve. Having other approvals helps though. |
``` | ||
|
||
- If you had to change the `AUDIENCE` URL for your region in step 2, update the main domain of the `--location` arg. | ||
- Replace `LONG_GIBBERISH_ACCESS_TOKEN_STRING` with the access token that you copied in the previous step. |
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.
The LONG_GIBBERISH_ACCESS_TOKEN_STRING
placeholder seems to have been missed during editing.
2 modifications: - we use bold to mark UI strings, no quotes required - we [favor select over click](https://learn.microsoft.com/en-us/style-guide/a-z-word-list-term-collections/c/click)
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.
Proposed change
Type of change
current
branch).current
branch).next
branch).next
branch).Additional information
Checklist
current
branch.next
branch.Summary by CodeRabbit
Summary by CodeRabbit