Skip to content
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

Merged

Conversation

andeart
Copy link
Contributor

@andeart andeart commented Jan 5, 2025

Proposed change

Type of change

  • Spelling, grammar or other readability improvements (current branch).
  • Adjusted missing or incorrect information in the current documentation (current branch).
  • Added documentation for a new integration I'm adding to Home Assistant (next branch).
  • Added documentation for a new feature I'm adding to Home Assistant (next branch).
  • Removed stale or deprecated documentation.

Additional information

  • Link to parent pull request in the codebase:
  • Link to parent pull request in the Brands repository:
  • This PR fixes or closes issue: fixes #134595 #133961.

Checklist

  • This PR uses the correct branch, based on one of the following:
    • I made a change to the existing documentation and used the current branch.
    • I made a change that is related to an upcoming version of Home Assistant and used the next branch.
  • The documentation follows the Home Assistant documentation standards.

Summary by CodeRabbit

Summary by CodeRabbit

  • Documentation
    • Enhanced Tesla Fleet API integration instructions.
    • Added prerequisites for web domain hosting.
    • Expanded developer application setup guide with detailed steps.
    • Introduced a troubleshooting section for integration issues.
    • Updated documentation to reflect January 2025 API pricing changes.
    • Improved overall clarity and readability of the documentation.

@home-assistant home-assistant bot added the current This PR goes into the current branch label Jan 5, 2025
Copy link

netlify bot commented Jan 5, 2025

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit 4bc8f59
🔍 Latest deploy log https://app.netlify.com/sites/home-assistant-docs/deploys/677ceb25ed25f10008f9026f
😎 Deploy Preview https://deploy-preview-36725--home-assistant-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

coderabbitai bot commented Jan 5, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The changes to the tesla_fleet.markdown file enhance the documentation for integrating the Tesla Fleet API with Home Assistant. Key updates include an expanded prerequisites section detailing domain hosting for a public key, a more structured guide for setting up the Developer Application, and the introduction of a troubleshooting section. The documentation has been refined for clarity, correcting typographical errors and restructuring sentences for better readability, while also clarifying the implications of the new pay-per-use pricing model.

Changes

File Change Summary
source/_integrations/tesla_fleet.markdown - Enhanced prerequisites section with domain hosting requirements for public key
- Detailed steps for generating and uploading public/private key pair
- Expanded Developer Application setup instructions
- Added new troubleshooting section
- Updated documentation for new API pricing model effective January 2025
- Improved overall documentation clarity and readability

Sequence Diagram

sequenceDiagram
    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
Loading

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 details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17a5a62 and 4bc8f59.

📒 Files selected for processing (1)
  • source/_integrations/tesla_fleet.markdown (2 hunks)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 issues

The 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 requirements

The 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

📥 Commits

Reviewing files that changed from the base of the PR and between 218ee90 and e307450.

📒 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

source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between e307450 and 2f9acaf.

📒 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)

source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2f9acaf and 68b55de.

📒 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)

@home-assistant
Copy link

home-assistant bot commented Jan 5, 2025

Hey there @Bre77, mind taking a look at this feedback as it has been labeled with an integration (tesla_fleet) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tesla_fleet can trigger bot actions by commenting:

  • @home-assistant close Closes the feedback.
  • @home-assistant rename Awesome new title Renames the feedback.
  • @home-assistant reopen Reopen the feedback.
  • @home-assistant unassign tesla_fleet Removes the current integration label and assignees on the feedback, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information) to the feedback.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information) on the feedback.

@rjgguk
Copy link

rjgguk commented Jan 5, 2025

Should also include guidance around the use of EU URL's for non-US/Asia users.

@Bre77
Copy link
Contributor

Bre77 commented Jan 5, 2025

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.

@andeart
Copy link
Contributor Author

andeart commented Jan 5, 2025

@rjgguk Good catch. I'll add details for those specific parts.

@Bre77 That makes sense, I'll add a note mentioning that. Appreciate the quick review, folks!

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 68b55de and 8e74868.

📒 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.

source/_integrations/tesla_fleet.markdown Show resolved Hide resolved
@andeart
Copy link
Contributor Author

andeart commented Jan 5, 2025

@Bre77 Details added, and ready for review. Let me know what you think please. Thanks!

source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
Comment on lines +100 to +112
```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'
```
Copy link
Contributor

@Bre77 Bre77 Jan 5, 2025

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.

Suggested change
```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'
```

Copy link
Contributor Author

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.

  1. I just verified the NA domain, and it looks correct. It appears unchanged in your suggestion too. Any idea what I may be missing?

  2. 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?

Copy link
Contributor

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.

Copy link
Contributor Author

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)?

source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
andeart and others added 3 commits January 5, 2025 15:42
Co-authored-by: Brett Adams <[email protected]>
Co-authored-by: Brett Adams <[email protected]>
Co-authored-by: Brett Adams <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8e74868 and 17a5a62.

📒 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)

Copy link
Contributor

@Bre77 Bre77 left a 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.

@andeart
Copy link
Contributor Author

andeart commented Jan 6, 2025

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/)
Copy link

@parkerbxyz parkerbxyz Jan 7, 2025

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.

Copy link
Contributor

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.

@andeart
Copy link
Contributor Author

andeart commented Jan 7, 2025

@Bre77 My apologies for being squeaky. Thanks for approving the PR again. I see At least 1 approving review is required by reviewers with write access on this PR's thread.
I've read the PR documentation which covers guidelines before a PR is reviewed, but I can't seem to find the next steps once a PR has been approved but waiting for a merge. Does your approval automatically send it to a queue for someone with write access to merge?

@Bre77
Copy link
Contributor

Bre77 commented Jan 7, 2025

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.

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.

source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
source/_integrations/tesla_fleet.markdown Outdated Show resolved Hide resolved
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)
Copy link
Contributor

@c0ffeeca7 c0ffeeca7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @andeart and @Bre77 👍

@c0ffeeca7 c0ffeeca7 merged commit ba3c5c2 into home-assistant:current Jan 7, 2025
5 of 7 checks passed
@Bre77
Copy link
Contributor

Bre77 commented Jan 7, 2025

FYI @andeart I'm also making command signing better by removing the Bluetooth process. #36775

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
current This PR goes into the current branch integration: tesla_fleet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementation not available - Tesla
7 participants