Skip to content

Conversation

@justdaniel-gh
Copy link

@justdaniel-gh justdaniel-gh commented Feb 1, 2026

Proposed change

Add logic to handle user code lengths other than 4, for Schlage locks that return ("0"*code_length) after clearing the user code.

I added a couple of tests as well. Could probably drop it to one test, and run through a few different lengths, but this seemed to at least test the core of the change.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

@codecov-commenter
Copy link

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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.62%. Comparing base (a9a30ef) to head (671c826).
⚠️ Report is 15 commits behind head on beta.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             beta     #557      +/-   ##
==========================================
+ Coverage   80.86%   83.62%   +2.75%     
==========================================
  Files          19       25       +6     
  Lines        2341     2711     +370     
==========================================
+ Hits         1893     2267     +374     
+ Misses        448      444       -4     
Flag Coverage Δ
python 83.62% <100.00%> (?)

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.

@firstof9 firstof9 linked an issue Feb 2, 2026 that may be closed by this pull request
@firstof9
Copy link
Collaborator

firstof9 commented Feb 2, 2026

Thanks!
Not a fan of schlage/yale and their firmware.

@firstof9 firstof9 merged commit b87b6c0 into FutureTense:beta Feb 2, 2026
6 checks passed
@justdaniel-gh
Copy link
Author

Yeah, not a fan either.

Also, just doing another look, while this does address the "0000" vs "000000" (or whatever else), I just noticed that function doesn't return False on failure.

    async def async_clear_usercode(self, slot_num: int) -> bool:
       ...
        try:
            usercode = get_usercode(self._node, slot_num)
            # Treat both "" and full string of "0" as cleared (Schlage BE469 firmware bug workaround)
            if not (
                usercode[ZWAVEJS_ATTR_USERCODE] == ""
                or all(char == "0" for char in usercode[ZWAVEJS_ATTR_USERCODE])
            ):
                _LOGGER.debug(
                    "[ZWaveJSProvider] Slot %s not yet cleared, will retry",
                    slot_num,
                )
        except BaseZwaveJSServerError as e:
        ...

@raman325 I didn't look too much deeper into the providers refactor. Looking at the base class method signature, should this return False after that debug statement?

@raman325
Copy link
Collaborator

raman325 commented Feb 2, 2026

The return is only used for logging it looks like. It looks like you changed the handler that checks whether the PIN was properly cleared, but it doesn't actually do anything as far as I can tell so I don't think this will resolve your issue.

I put up a different PR that might be more effective: #558

I also fixed the returns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ISSUE: Infinite Loop when Clearing Pin (Schlage Bug)

4 participants