feat: add Schlage WiFi lock provider#588
Conversation
Add a new provider for Schlage WiFi locks that maps cloud-managed access codes to keymaster's slot-based model. Codes are tagged with a [KM:<slot>] prefix in their friendly name so the mapping persists across restarts. Pre-existing codes on the lock are automatically assigned to the next available slot and their original name is preserved both on the lock tag and in the keymaster slot. Key behaviors: - Only codes within the configured managed slot range are tagged and returned; codes outside the range (tagged or untagged) are left untouched on the lock. - Pre-existing lock codes are imported during onboarding rather than cleared, preserving both PINs and friendly names. - The coordinator now passes the keymaster slot name to the provider when setting codes, so Schlage uses the real name instead of falling back to "Code Slot N". - Renaming a slot in keymaster re-pushes the code to the lock so the provider can update the on-device name (e.g., Schlage tag). - Connection status is supported, enabling the Network binary sensor (binary_sensor.<lock>_network) for Schlage locks. All lock operations use Home Assistant Schlage integration services (schlage.get_codes, schlage.add_code, schlage.delete_code) rather than importing pyschlage directly, so the provider is safe to load even when the Schlage integration is not configured. Co-Authored-By: GitHub Copilot <copilot@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #588 +/- ##
==========================================
+ Coverage 84.14% 89.71% +5.56%
==========================================
Files 10 28 +18
Lines 801 3450 +2649
==========================================
+ Hits 674 3095 +2421
- Misses 127 355 +228
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f679ede to
2e97682
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new Keymaster lock provider for Schlage WiFi locks (via the Home Assistant schlage integration) and wires it into the provider registry, along with tests and HA minimum-version bumps for HACS.
Changes:
- Introduces
SchlageLockProviderwith code slot discovery/tagging and set/clear operations usingschlage.*services. - Registers the new provider in the provider map and adds
schlageto integration dependencies/codeowners. - Adds a dedicated test suite for the Schlage provider and bumps HACS minimum HA version.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
custom_components/keymaster/providers/schlage.py |
New Schlage provider implementation using HA services for code management. |
custom_components/keymaster/providers/__init__.py |
Registers schlage provider in the provider registry. |
custom_components/keymaster/manifest.json |
Adds schlage to after_dependencies and updates codeowners. |
hacs.json |
Bumps minimum Home Assistant version for HACS installs. |
tests/providers/test_schlage.py |
Adds unit tests covering connect/connection status and code operations/tagging behavior. |
Comments suppressed due to low confidence (1)
custom_components/keymaster/manifest.json:33
- PR description says the minimum HA version was bumped in
manifest.json, but the manifest does not declare ahomeassistant/min-version field (onlyhacs.jsonwas updated). If Schlage action support truly requires HA 2026.4.0+, consider enforcing that in the integration metadata (or adjusting the PR description) so manual installs on older HA fail fast with a clear requirement instead of runtime errors.
{
"domain": "keymaster",
"name": "keymaster",
"after_dependencies": [
"automation",
"http",
"input_boolean",
"input_datetime",
"input_number",
"input_text",
"local_akuvox",
"mqtt",
"ozw",
"schlage",
"script",
"template",
"zwave",
"zwave_js"
],
"codeowners": [
"@FutureTense",
"@firstof9",
"@raman325",
"@tykeal"
],
"config_flow": true,
"dependencies": [],
"documentation": "https://github.com/FutureTense/keymaster",
"iot_class": "local_polling",
"issue_tracker": "https://github.com/FutureTense/keymaster/issues",
"requirements": [],
"version": "v0.0.0"
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2e97682 to
c629560
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c629560 to
2344c24
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2344c24 to
d80ad60
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d80ad60 to
b2bf19a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b2bf19a to
36181f3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
36181f3 to
30ca9f6
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
30ca9f6 to
6f6b27e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Update homeassistant requirement to 2026.4.0 in both manifest.json and hacs.json. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
6f6b27e to
f56144f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Local tests are good @tykeal? |
|
Yes. But we should wait to merge this until 2026.4 drops as it's a requirement for this |
|
2026.4 has dropped. I'm going to go ahead and merge this and get a release out. |
Summary
Adds a new lock provider for Schlage WiFi smart locks, enabling Keymaster to manage code slots on Schlage locks via the
schlageHome Assistant integration.Changes
providers/schlage.py: NewSchlageProviderimplementing code slot management (get/set/clear) via Schlage actionsproviders/__init__.py: Register the Schlage provider in the provider registrymanifest.json: Addschlagetoafter_dependencies, add@tykealas codeownerhacs.json: Bump minimum HA version to2026.4.0tests/providers/test_schlage.py: Comprehensive test suite for the Schlage providerNotes