Skip to content

fix(zwave): migrate schedule user handling to unified access-control APIs#4614

Draft
robertsLando with Copilot wants to merge 5 commits into
masterfrom
copilot/feat-use-new-user-cc-apis
Draft

fix(zwave): migrate schedule user handling to unified access-control APIs#4614
robertsLando with Copilot wants to merge 5 commits into
masterfrom
copilot/feat-use-new-user-cc-apis

Conversation

Copilot AI commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

This updates schedule-related user handling to use the new unified user/credential APIs introduced in zwave-js, replacing legacy User Code CC-specific cache access. The goal is to keep schedule behavior aligned while supporting both User Code CC and User Credential CC via a single access-control surface.

  • Access-control API migration (schedule path)

    • Replaced UserCodeCC.getSupportedUsersCached(...) with endpoint.getUserCapabilitiesCached()?.maxUsers.
    • Replaced UserCodeCC.getUserIdStatusCached(...) checks with endpoint.getUserCached(userId) presence checks.
    • Removed direct dependency on UserCodeCC in this flow.
  • Enabled-state compatibility

    • Preserved existing Schedule Entry Lock enabled-state behavior.
    • Extended enabled detection to also consider unified user state (user.active) when populating node.userCodes.enabled.
  • Operational clarity

    • Added debug logging when user capabilities are not yet cached to make “no users scanned” behavior explicit.
const userCapabilities = endpoint.getUserCapabilitiesCached()
const maxUsers = userCapabilities?.maxUsers ?? 0

for (let i = 1; i <= maxUsers; i++) {
  const user = endpoint.getUserCached(i)
  if (!user) continue

  const enabledUserId = ScheduleEntryLockCC.getUserCodeScheduleEnabledCached(
    this.driver,
    endpoint,
    i,
  )

  if (enabledUserId || user.active) {
    node.userCodes.enabled.push(i)
  }
}

Copilot AI linked an issue Apr 13, 2026 that may be closed by this pull request
Copilot AI and others added 3 commits April 13, 2026 10:22
Agent-Logs-Url: https://github.com/zwave-js/zwave-js-ui/sessions/b1ba95fa-c621-40e8-8a8d-d6c1e8641c40

Co-authored-by: robertsLando <11502495+robertsLando@users.noreply.github.com>
Agent-Logs-Url: https://github.com/zwave-js/zwave-js-ui/sessions/b1ba95fa-c621-40e8-8a8d-d6c1e8641c40

Co-authored-by: robertsLando <11502495+robertsLando@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to use new user CC APIs fix(zwave): migrate schedule user handling to unified access-control APIs Apr 13, 2026
Copilot AI requested a review from robertsLando April 13, 2026 10:29
@robertsLando
robertsLando requested a review from AlCalzone April 13, 2026 12:05
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 24342537954

Coverage increased (+0.002%) to 18.302%

Details

  • Coverage increased (+0.002%) from the base build.
  • Patch coverage: 17 uncovered changes across 1 file (0 of 17 lines covered, 0.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
api/lib/ZwaveClient.ts 17 0 0.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 23536
Covered Lines: 4054
Line Coverage: 17.22%
Relevant Branches: 445
Covered Branches: 335
Branch Coverage: 75.28%
Branches in Coverage %: Yes
Coverage Strength: 1.09 hits per line

💛 - Coveralls

@robertsLando

Copy link
Copy Markdown
Member

I would hold off a bit on that.
Schedule Entry Lock CC does not work with User Credential CC - there is a new scheduling CC I haven't implemented yet.
Which means there will also be a unified scheduling API to support both

From @AlCalzone

@github-actions

Copy link
Copy Markdown
Contributor

This pull-request is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this pull-request entirely you can add the no-stale label

@github-actions github-actions Bot added the Stale label Jul 13, 2026
@AlCalzone

Copy link
Copy Markdown
Member

zwave-js/zwave-js#8947

@AlCalzone AlCalzone added no-stale and removed Stale labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: use new user cc apis

4 participants