-
Notifications
You must be signed in to change notification settings - Fork 54
fix: immediately update UI when accesslimit_count changes #554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: beta
Are you sure you want to change the base?
Conversation
|
@tykeal try this PR for the number of uses fix |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## beta #554 +/- ##
==========================================
+ Coverage 80.86% 83.27% +2.41%
==========================================
Files 19 21 +2
Lines 2341 2482 +141
==========================================
+ Hits 1893 2067 +174
+ Misses 448 415 -33
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where the "Uses Remaining" number entity does not update immediately when a lock code is used. The fix adds calls to async_set_updated_data() immediately after decrementing the accesslimit_count in the _lock_unlocked() event handler, ensuring entities are notified of the change without waiting for the next scheduled coordinator update (which runs every 60 seconds).
Changes:
- Added
async_set_updated_data()calls after decrementingaccesslimit_countfor parent locks (line 840) - Added
async_set_updated_data()calls after decrementingaccesslimit_countfor regular locks (line 846)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bd56fc7 to
61d9e0f
Compare
|
@eallison978 try this PR, I fixed the wrong area and did it the wrong way, this should address all of it |
|
I used HACS to install this. How long do you think it will before HACS recognizes it? |
|
ah, so you were using code that hasn't been fixed yet. You'd have to download the branch and install it manually, and if you haven't done that, you wouldn't have the fix from the other PR either. Hopefully between that PR and this one it is addressed, and then it will be resolved in the next release |
|
I apologize for the mix up 🤦♂️ I'll see if I can figure out and work up
the appetite to manually install it
|
|
fwiw ... 0.1.2 is what I'm running |
|
no worries thanks for giving it a whirl and if you do end up doing a manual install would appreciate the feedback! |
|
If I decide to wait for the HACS update, do you have an idea how long that wait would be? |
|
@raman325 gave it an install and here's my finding: UI seems to be lagging off by one. Put in 3 and when I opened the lock it didn't decrement until I did it again. From then on it counted down properly. That being said, I ran through 3 (4) cycles quickly in less than a minute (actually ended up being even more) as it didn't start pulling the code until it was at 0 and had been there for at least 30 seconds :-/ so, it's getting better... |
61d9e0f to
7be7044
Compare
When accesslimit_count changes (either by code usage or user input), update the UI immediately instead of waiting for coordinator refresh. Changes: - Add async_set_updated_data() calls in _lock_unlocked() after decrementing accesslimit_count (for both parent and child locks) - Call _update_slot() after decrement to check if slot should be deactivated and clear PIN from lock when count reaches 0 - Add async_write_ha_state() in number entity's async_set_native_value() for immediate feedback when user changes the value The UI notification happens before _update_slot() so users see the count change immediately, even before the potentially slow PIN clear operation completes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7be7044 to
bcacb3e
Compare
|
@tykeal third times a charm? |
Summary
async_set_updated_data()calls after decrementingaccesslimit_countin_lock_unlocked()for both parent and child locks_update_slot()after decrement to check if slot should be deactivated and clear PIN from lock when count reaches 0async_write_ha_state()in number entity'sasync_set_native_value()for immediate UI feedback when user changes the valueThe UI notification happens before
_update_slot()so users see the count change immediately, even before the potentially slow PIN clear operation completes.Test plan
Related
Reported in PR #538 comments by @tykeal
🤖 Generated with Claude Code