chore: Expose oauth constants#725
Merged
CFenner merged 4 commits intoopenviess:masterfrom Mar 18, 2026
Merged
Conversation
Move AUTHORIZE_URL, TOKEN_URL, and VIESSMANN_SCOPE to PyViCareAbstractOAuthManager as the single source of truth. Both PyViCareOAuthManager and PyViCareBrowserOAuthManager now import from there. This aligns the scope to ["IoT User", "offline_access"] for both managers. Previously, the password-grant manager used only ["IoT User"], which meant tokens had no refresh capability.
CFenner
requested changes
Mar 18, 2026
Member
CFenner
left a comment
There was a problem hiding this comment.
I would rather replace the usage of VIESSMANN_SCOPE with the actual scope lists ([SCOPE_IOT, SCOPE_OFFLINE_ACCESS]).
| API_BASE_URL = 'https://api.viessmann-climatesolutions.com/iot/v2' | ||
| AUTHORIZE_URL = 'https://iam.viessmann-climatesolutions.com/idp/v3/authorize' | ||
| TOKEN_URL = 'https://iam.viessmann-climatesolutions.com/idp/v3/token' | ||
| VIESSMANN_SCOPE = ["IoT User", "offline_access"] |
Member
There was a problem hiding this comment.
Lets properly define all available scopes:
Suggested change
| VIESSMANN_SCOPE = ["IoT User", "offline_access"] | |
| SCOPE_IOT = "IoT" | |
| SCOPE_USER = "User" | |
| SCOPE_OFFLINE_ACCESS = "offline_access" | |
| SCOPE_INTERNAL = "internal" |
Replace VIESSMANN_SCOPE list with individual constants: SCOPE_IOT, SCOPE_USER, SCOPE_OFFLINE_ACCESS, SCOPE_INTERNAL. Each manager builds its own scope list from these constants, making it explicit which scopes each flow requests.
CFenner
reviewed
Mar 18, 2026
Co-authored-by: Christopher Fenner <9592452+CFenner@users.noreply.github.com>
CFenner
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move
AUTHORIZE_URL,TOKEN_URL, andVIESSMANN_SCOPEtoPyViCareAbstractOAuthManageras the single source of truth. BothPyViCareOAuthManagerandPyViCareBrowserOAuthManagernow import from there.This aligns the scope to
["IoT User", "offline_access"]for both managers. Previously, the password-grant manager used only["IoT User"], which meant tokens had no refresh capability — they expired after 1h with no way to renew without re-authenticating with username/password.Adding
offline_accessto the password-grant flow gives it a refresh token too, improving reliability for long-running sessions.Related: #724, home-assistant/core#165621