feat: add QR scanner view and improve registration logic for QR callback#7
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds a local QR scanner view to enable QR code scanning directly within Home Assistant when HTTPS is available, falling back to an external scanner when only HTTP is available. This improves the user experience for Siedle device configuration by allowing camera-based QR scanning within the local instance.
Changes:
- Added
SiedleQRScannerViewclass to serve an HTML page with embedded QR scanner functionality - Updated view registration logic in both
async_setup()andasync_step_user()to register both callback and scanner views - Modified URL construction logic to detect HTTPS availability and choose between local scanner or external hosted scanner
- Changed callback URL encoding from
safe=':/'tosafe=''
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 14 comments.
| File | Description |
|---|---|
| custom_components/siedle/init.py | Added QR_SCANNER_HTML template (~300 lines) and SiedleQRScannerView class; updated async_setup() to register the new scanner view |
| custom_components/siedle/config_flow.py | Modified async_step_user() to import and register scanner view, added HTTPS detection logic, changed callback_url encoding |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Added the qr_scanner view to the local instance. This only works if a https connection is available.