TobiasLaross / Hass-Lynk-Co

Home Assistant integration for Lynk & Co
MIT License
37 stars 1 forks source link

Added lock to not have duplicate calls to refresh token #15

Closed TobiasLaross closed 7 months ago

TobiasLaross commented 7 months ago

Summary by CodeRabbit

coderabbitai[bot] commented 7 months ago

Walkthrough

The latest update enhances the integration with Lynk & Co's services by warning about potential account blocking, updating the software version, refining token management with asynchronous controls, and improving efficiency by eliminating redundant API calls.

Changes

File Path Change Summary
README.md Introduced a warning about potential account blocking.
.../lynkco/manifest.json Updated version number from "1.1.1" to "1.1.2".
.../lynkco/token_manager.py Added asyncio import, global variable, async handling.
release-notes Removed duplicate API call for refresh token in new version.

🐰✨ Oh hark! A change does come, In code, where numbers run. From Lynk & Co, a tweak, For smoother run, we seek. Locks in place, no more dupe, On version's wings, we swoop! 🚀 🐰✨


Recent Review Details **Configuration used: CodeRabbit UI**
Commits Files that changed from the base of the PR and between 1fcfb9756df34ade772698fdcb04559842858940 and 9e6d657798df4698e6d7777d6256608f19633aac.
Files selected for processing (4) * README.md (1 hunks) * custom_components/lynkco/manifest.json (1 hunks) * custom_components/lynkco/token_manager.py (2 hunks) * release-notes (1 hunks)
Files skipped from review as they are similar to previous changes (3) * custom_components/lynkco/manifest.json * custom_components/lynkco/token_manager.py * release-notes
Additional Context Used
LanguageTool (40)
README.md (40)
Near line 1: Possible spelling mistake found. Context: # Lynk & Co Home Assistant Custom Component #... --- Near line 3: Possible spelling mistake found. Context: ...Warning**: Use of this integration with Lynk & Co's services might lead to your acco... --- Near line 6: Possible spelling mistake found. Context: ...nt users to integrate and control their Lynk & Co vehicles directly from Home Assist... --- Near line 10: Possible spelling mistake found. Context: ...cle management. This has been tested on european models only. ## Table of Contents - [W... --- Near line 17: Possible spelling mistake found. Context: ...s) - [Adding the Custom Repository to HACS](#adding-the-custom-repository-to-hacs)... --- Near line 34: Possible spelling mistake found. Context: ...ome Assistant running. - Access to your Lynk & Co account credentials. - Your vehicl... --- Near line 37: Possible spelling mistake found. Context: ...N. ### Adding the Custom Repository to HACS 1. Navigate to HACS in Home Assistant. ... --- Near line 38: Possible spelling mistake found. Context: ...ustom Repository to HACS 1. Navigate to HACS in Home Assistant. 2. Go to "Integratio... --- Near line 40: Consider adding a hyphen. Context: ...ons". 3. Click on the three dots in the top right corner and select "Custom repositories"... --- Near line 46: Possible spelling mistake found. Context: ... Installing the Integration 1. Find the Lynk & Co integration in the HACS Integratio... --- Near line 46: Possible spelling mistake found. Context: .... Find the Lynk & Co integration in the HACS Integrations section and click "Install... --- Near line 54: Possible spelling mistake found. Context: ...ck on "Add Integration" and search for "Lynk & Co". 3. Follow the on-screen instruct... --- Near line 64: Possible spelling mistake found. Context: ...ure is experimental and undocumented by Lynk & Co.) - `force_update_data`: Forcing u... --- Near line 65: Loose punctuation mark. Context: ...ted by Lynk & Co.) - `force_update_data`: Forcing update data from the vehicle, b... --- Near line 66: Loose punctuation mark. Context: ...ypassing night limit. - `refresh_tokens`: Refreshes authentication tokens, this s... --- Near line 70: This sentence does not start with an uppercase letter. Context: ... #### Detailed Service Information - **start_engine / stop_engine**: This service al... --- Near line 70: Possible spelling mistake found. Context: ...feature not officially supported by the Lynk & Co app. Use with caution, as it may n... --- Near line 71: “Service” is a singular noun. It appears that the verb form is incorrect. Context: ...climate will be set to HI, this service have not been tested without sufficient EV b... --- Near line 74: Possible spelling mistake found. Context: ...rehensive monitoring and control of the Lynk & Co vehicle, including both sensors an... --- Near line 76: Possible typo: you repeated a word Context: ... both sensors and binary sensors. #### Sensors Sensors provide detailed information about vari... --- Near line 79: Possible spelling mistake found. Context: ...us and environment. These include: - **Lynk & Co Odometer**: Measures the total dis... --- Near line 80: Possible spelling mistake found. Context: ...vehicle has traveled in kilometers. - **Lynk & Co Battery**: Shows the current batte... --- Near line 81: Possible spelling mistake found. Context: ...ttery charge level as a percentage. - **Lynk & Co Fuel Level**: Displays the current... --- Near line 82: Possible spelling mistake found. Context: ...s the current fuel level in liters. - **Lynk & Co Fuel Level Status**: Indicates the... --- Near line 83: Possible spelling mistake found. Context: ...cates the status of the fuel level. - **Lynk & Co Fuel Distance**: Reports the estim... --- Near line 84: Possible spelling mistake found. Context: ...e traveled with the remaining fuel. - **Lynk & Co Time Until Charged**: Provides the... --- Near line 85: Possible spelling mistake found. Context: ...until the battery is fully charged. - **Lynk & Co Battery Distance**: Shows the esti... --- Near line 86: Possible spelling mistake found. Context: ...be traveled on battery power alone. - **Lynk & Co Interior Temperature**: Reports th... --- Near line 87: Possible spelling mistake found. Context: ...ide the vehicle in degrees Celsius. - **Lynk & Co Exterior Temperature**: Displays t... --- Near line 88: Possible spelling mistake found. Context: ...ide the vehicle in degrees Celsius. - **Lynk & Co Charger Connection Status**: Indic... --- Near line 89: Possible spelling mistake found. Context: ...arger is connected or disconnected. - **Lynk & Co Charge State**: Shows the current ... --- Near line 90: Possible spelling mistake found. Context: ...rent charging state of the vehicle. - **Lynk & Co Address**: Displays the vehicle's ... --- Near line 91: Possible spelling mistake found. Context: ...address in a human-readable format. - **Lynk & Co Address Raw**: Provides the vehicl... --- Near line 92: Possible spelling mistake found. Context: ... integration with mapping services. - **Lynk & Co Door Lock Status**: Indicates the ... --- Near line 93: Possible spelling mistake found. Context: ...lock status of the vehicle's doors. - **Lynk & Co Last Updated by Car**: Timestamp o... --- Near line 95: This phrase is duplicated. You should probably use “Binary Sensors” only once. Context: ...update received from the vehicle. #### Binary Sensors Binary sensors indicate specific vehicle states that h... --- Near line 98: Possible spelling mistake found. Context: ...ture before you enter. It uses the icon `mdi:air-conditioner` to visually represent ... --- Near line 99: Only proper nouns start with an uppercase character (there are exceptions for headlines). Context: ...n the Home Assistant UI. - **Vehicle is Running**: Shows if the vehicle's engine is cur... --- Near line 99: Possible spelling mistake found. Context: ...onal state of your vehicle and uses the `mdi:engine` icon for easy identification. ... --- Near line 106: Possible spelling mistake found. Context: ...h good cellular reception and that your Lynk & Co account is active and not facing a...
Additional comments not posted (1)
README.md (1)
`3-3`: The addition of the warning about potential account blocking is clear and effectively communicates the risks associated with using the integration. This is a crucial update for user awareness.
--- 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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `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 generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@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.` 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 as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.