Skip to content

feat: add Schlage WiFi lock provider#588

Merged
tykeal merged 2 commits intoFutureTense:mainfrom
tykeal:schlage_provider
Apr 1, 2026
Merged

feat: add Schlage WiFi lock provider#588
tykeal merged 2 commits intoFutureTense:mainfrom
tykeal:schlage_provider

Conversation

@tykeal
Copy link
Copy Markdown
Collaborator

@tykeal tykeal commented Mar 25, 2026

Summary

Adds a new lock provider for Schlage WiFi smart locks, enabling Keymaster to manage code slots on Schlage locks via the schlage Home Assistant integration.

Changes

  • providers/schlage.py: New SchlageProvider implementing code slot management (get/set/clear) via Schlage actions
  • providers/__init__.py: Register the Schlage provider in the provider registry
  • manifest.json: Add schlage to after_dependencies, add @tykeal as codeowner
  • hacs.json: Bump minimum HA version to 2026.4.0
  • tests/providers/test_schlage.py: Comprehensive test suite for the Schlage provider

Notes

  • Requires HA 2026.4.0+ which includes the necessary Schlage integration actions for code slot management
  • Uses polling-based code slot sync (no push updates); Schlage integration does not currently expose lock events suitable for real-time subscriptions
  • Follows the same provider pattern as existing Akuvox and Z-Wave JS providers

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>
@github-actions github-actions Bot added the feature New feature label Mar 25, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 25, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 99.14894% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.71%. Comparing base (cdb4922) to head (f56144f).
⚠️ Report is 70 commits behind head on main.

Files with missing lines Patch % Lines
custom_components/keymaster/providers/schlage.py 99.14% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
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     
Flag Coverage Δ
python 89.71% <99.14%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SchlageLockProvider with code slot discovery/tagging and set/clear operations using schlage.* services.
  • Registers the new provider in the provider map and adds schlage to 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 a homeassistant/min-version field (only hacs.json was 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.

Comment thread custom_components/keymaster/providers/schlage.py Outdated
Comment thread custom_components/keymaster/providers/schlage.py Outdated
Comment thread custom_components/keymaster/providers/schlage.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/providers/test_schlage.py Outdated
Comment thread custom_components/keymaster/providers/schlage.py
Comment thread custom_components/keymaster/providers/schlage.py
Comment thread tests/providers/test_schlage.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread custom_components/keymaster/providers/schlage.py
Comment thread custom_components/keymaster/providers/schlage.py Outdated
Comment thread tests/providers/test_schlage.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread custom_components/keymaster/providers/schlage.py Outdated
Comment thread custom_components/keymaster/providers/schlage.py Outdated
Comment thread custom_components/keymaster/providers/schlage.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread custom_components/keymaster/providers/schlage.py
Comment thread tests/providers/test_schlage.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread custom_components/keymaster/providers/schlage.py
Comment thread custom_components/keymaster/providers/schlage.py Outdated
Comment thread tests/providers/test_schlage.py Outdated
Comment thread tests/providers/test_schlage.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread custom_components/keymaster/providers/schlage.py
Comment thread custom_components/keymaster/providers/schlage.py
Comment thread tests/providers/test_schlage.py
Comment thread tests/providers/test_schlage.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread custom_components/keymaster/providers/schlage.py Outdated
Comment thread tests/providers/test_schlage.py Outdated
Comment thread custom_components/keymaster/providers/schlage.py Outdated
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tykeal tykeal requested review from firstof9 and raman325 March 29, 2026 18:15
@firstof9
Copy link
Copy Markdown
Collaborator

Local tests are good @tykeal?

@tykeal
Copy link
Copy Markdown
Collaborator Author

tykeal commented Mar 29, 2026

Yes. But we should wait to merge this until 2026.4 drops as it's a requirement for this

@tykeal
Copy link
Copy Markdown
Collaborator Author

tykeal commented Apr 1, 2026

2026.4 has dropped. I'm going to go ahead and merge this and get a release out.

@tykeal tykeal merged commit 5aecf76 into FutureTense:main Apr 1, 2026
13 checks passed
@tykeal tykeal deleted the schlage_provider branch April 1, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants