Skip to content

Replace access token authentication with OAuth2 in Teslemetry#158905

Merged
joostlek merged 32 commits into
home-assistant:devfrom
Bre77:t-oauth
Dec 29, 2025
Merged

Replace access token authentication with OAuth2 in Teslemetry#158905
joostlek merged 32 commits into
home-assistant:devfrom
Bre77:t-oauth

Conversation

@Bre77
Copy link
Copy Markdown
Contributor

@Bre77 Bre77 commented Dec 13, 2025

Breaking change

Teslemetry will no longer use the provided access token, and instead will be automatically migrated to an OAuth registration. You can manage your application registrations on the Teslemetry Console.

Proposed change

Teslemetry Config Flow is now version 2, and is a PKRE OAuth2 implementation using a hardcoded client ID and no client secret. This removes the need for the user to copy and paste an access token (which surprisingly was causing friction), and now uses a simple OAuth2 flow.

Needs #159056 and #159048 which have been rebased into this PR so that its functional.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@Bre77
Copy link
Copy Markdown
Contributor Author

Bre77 commented Dec 13, 2025

I'm not 100% sure if this is actually a breaking change, its a major change, but I built a migration path that should be seemless.

@Bre77 Bre77 marked this pull request as ready for review December 13, 2025 10:18
@Bre77 Bre77 force-pushed the t-oauth branch 4 times, most recently from f7ac775 to 0269128 Compare December 15, 2025 01:14
@Bre77
Copy link
Copy Markdown
Contributor Author

Bre77 commented Dec 15, 2025

Test failure is unrelated

@Bre77 Bre77 force-pushed the t-oauth branch 2 times, most recently from a829c09 to 3ceae63 Compare December 16, 2025 11:58
Comment thread homeassistant/components/teslemetry/oauth.py
Comment thread homeassistant/components/teslemetry/__init__.py Outdated
Comment thread tests/components/teslemetry/__init__.py Outdated
Comment thread tests/components/teslemetry/__init__.py Outdated
Comment thread tests/components/teslemetry/test_config_flow.py
Comment thread tests/components/teslemetry/test_config_flow.py Outdated
Comment thread tests/components/teslemetry/test_config_flow.py Outdated
Comment thread tests/components/teslemetry/test_config_flow.py
Comment thread tests/components/teslemetry/test_config_flow.py Outdated
Comment thread tests/components/teslemetry/test_config_flow.py Outdated
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant Bot marked this pull request as draft December 18, 2025 17:20
@Bre77 Bre77 marked this pull request as ready for review December 19, 2025 12:09
@home-assistant home-assistant Bot requested a review from joostlek December 19, 2025 12:09
Comment thread homeassistant/components/teslemetry/config_flow.py Outdated
Comment thread tests/components/teslemetry/conftest.py Outdated
Comment thread tests/components/teslemetry/conftest.py Outdated
Comment thread tests/components/teslemetry/test_config_flow.py
Comment thread tests/components/teslemetry/test_config_flow.py Outdated
Comment thread tests/components/teslemetry/test_init.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft December 23, 2025 20:38
@Bre77 Bre77 requested a review from joostlek December 23, 2025 22:04
@Bre77 Bre77 marked this pull request as ready for review December 23, 2025 22:10
@joostlek joostlek merged commit 043465e into home-assistant:dev Dec 29, 2025
36 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants