Skip to content

Add support for Z-Wave credential management#168360

Merged
MartinHjelmare merged 26 commits into
home-assistant:devfrom
AlCalzone:zwave-credentials
May 20, 2026
Merged

Add support for Z-Wave credential management#168360
MartinHjelmare merged 26 commits into
home-assistant:devfrom
AlCalzone:zwave-credentials

Conversation

@AlCalzone

@AlCalzone AlCalzone commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Proposed change

This PR adds support for Z-Wave credential management. This first iteration is aligned with the Matter credential mangement added in #161936, home-assistant/frontend#28672 and followup PRs.

The main difference is that this PR also adds support for having multiple credentials of the same type per user, and distinguishes between PINs (0-9) and passwords (alphanumeric).

Like Matter, we expose the credential management through the lock entity. Even though the functionality is technically not limited to locks, in practice there haven't been any non-lock devices with user management features.

Depends on home-assistant-libs/zwave-js-server-python#1418

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copilot AI review requested due to automatic review settings April 16, 2026 10:25
@home-assistant home-assistant Bot added cla-signed has-tests integration: zwave_js Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage Quality Scale: No score labels Apr 16, 2026
@home-assistant

Copy link
Copy Markdown
Contributor

Hey there @home-assistant/z-wave, mind taking a look at this pull request as it has been labeled with an integration (zwave_js) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of zwave_js can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign zwave_js Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Introduces first-pass Z-Wave JS “Access Control” (credential/user) management via new lock entity services, helper logic, and accompanying UI strings/icons plus tests.

Changes:

  • Add access_control_helpers.py implementing user/credential CRUD, capability queries, and auto-slot selection.
  • Register new credential-management services and wire them through the Z-Wave lock entity.
  • Add service UI metadata (strings/icons/services.yaml) and initial test coverage.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
homeassistant/components/zwave_js/access_control_helpers.py New helper module implementing access-control business logic and structured service responses.
homeassistant/components/zwave_js/lock.py Adds lock entity methods for new access-control services with translated error wrapping.
homeassistant/components/zwave_js/services.py Registers new platform entity services and validates service schemas.
homeassistant/components/zwave_js/services.yaml Declares new services and selectors for the service UI.
homeassistant/components/zwave_js/strings.json Adds translated error messages and service field descriptions for credential management.
homeassistant/components/zwave_js/icons.json Adds service icons for the new credential/user services.
homeassistant/components/zwave_js/const.py Adds service/attribute constants and credential/user type string constants.
tests/components/zwave_js/test_credential_services.py Adds tests for new credential management services and auto-find behavior.

Comment thread tests/components/zwave_js/test_credential_services.py Outdated
Comment thread tests/components/zwave_js/test_credential_services.py Outdated
Comment thread homeassistant/components/zwave_js/services.py Outdated
Comment thread homeassistant/components/zwave_js/services.py Outdated
Comment thread homeassistant/components/zwave_js/lock.py Outdated
Comment thread homeassistant/components/zwave_js/access_control_helpers.py Outdated
Comment thread homeassistant/components/zwave_js/lock.py Outdated
Comment thread homeassistant/components/zwave_js/services.py Outdated
Comment thread homeassistant/components/zwave_js/lock_helpers.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 10 out of 10 changed files in this pull request and generated 10 comments.

Comment thread homeassistant/components/zwave_js/lock_helpers.py
Comment thread homeassistant/components/zwave_js/services.py Outdated
Comment thread homeassistant/components/zwave_js/lock_helpers.py
Comment thread homeassistant/components/zwave_js/access_control_helpers.py Outdated
Comment thread homeassistant/components/zwave_js/services.yaml
Comment thread homeassistant/components/zwave_js/services.py Outdated
Comment thread homeassistant/components/zwave_js/access_control_helpers.py Outdated
Comment thread homeassistant/components/zwave_js/services.yaml Outdated
Comment thread homeassistant/components/zwave_js/access_control_helpers.py Outdated
Comment thread homeassistant/components/zwave_js/lock_helpers.py
Copilot AI review requested due to automatic review settings April 23, 2026 13:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 11 out of 11 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/zwave_js/access_control_helpers.py Outdated
Comment thread homeassistant/components/zwave_js/access_control_helpers.py Outdated
Comment thread tests/components/zwave_js/test_credential_services.py
Comment thread homeassistant/components/zwave_js/lock_helpers.py
Copilot AI review requested due to automatic review settings April 24, 2026 12:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread homeassistant/components/zwave_js/access_control_helpers.py Outdated
@AlCalzone AlCalzone changed the title First draft of Z-Wave credential management Add support for Z-Wave credential management Apr 24, 2026
Copilot AI review requested due to automatic review settings April 29, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 11 out of 11 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/zwave_js/access_control_helpers.py Outdated
Comment thread homeassistant/components/zwave_js/access_control_helpers.py Outdated
Comment thread homeassistant/components/zwave_js/lock_helpers.py
Comment thread tests/components/zwave_js/test_credential_services.py Outdated
@AlCalzone

This comment was marked as resolved.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 11 out of 11 changed files in this pull request and generated 1 comment.

Comment on lines +82 to +86
async_register_platform_entity_service(
hass,
const.DOMAIN,
"set_user",
entity_domain=LOCK_DOMAIN,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, Martin said explicitly to not do that.

@abmantis something for the agent instructions maybe?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we need to add this to instructions, unless we see it happen more often (I haven't seen it before). It probably pointed it out because the integration does that for the other service and the new ones are inconsistent.

Comment thread homeassistant/components/zwave_js/access_control_helpers.py Outdated
Comment thread homeassistant/components/zwave_js/strings.json
Comment thread homeassistant/components/zwave_js/strings.json
Comment thread homeassistant/components/zwave_js/strings.json
Comment thread homeassistant/components/zwave_js/strings.json
Comment thread homeassistant/components/zwave_js/strings.json
Comment thread homeassistant/components/zwave_js/strings.json
Comment thread homeassistant/components/zwave_js/strings.json
Comment thread homeassistant/components/zwave_js/strings.json
Comment thread homeassistant/components/zwave_js/strings.json
@MartinHjelmare
MartinHjelmare marked this pull request as draft May 13, 2026 13:00
Copilot AI review requested due to automatic review settings May 18, 2026 11:48
@AlCalzone
AlCalzone marked this pull request as ready for review May 18, 2026 11:49
@AlCalzone
AlCalzone requested a review from MartinHjelmare May 18, 2026 11:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 11 out of 11 changed files in this pull request and generated 5 comments.

Comment thread homeassistant/components/zwave_js/lock_helpers.py
Comment thread homeassistant/components/zwave_js/lock_helpers.py Outdated
Comment thread homeassistant/components/zwave_js/services.py
Comment thread homeassistant/components/zwave_js/lock.py
Comment on lines +765 to +766
"١٢٣٤", # Arabic-Indic digits — str.isdigit() returns True
"1234", # Fullwidth digits — str.isdigit() returns True

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok to add, but not required.

@AlCalzone

Copy link
Copy Markdown
Contributor Author

The test failure looks unrelated

@MartinHjelmare

Copy link
Copy Markdown
Member

One question left:
#168360 (comment)

@MartinHjelmare
MartinHjelmare marked this pull request as draft May 19, 2026 08:48
Copilot AI review requested due to automatic review settings May 19, 2026 13:25
@AlCalzone
AlCalzone marked this pull request as ready for review May 19, 2026 13:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 11 out of 11 changed files in this pull request and generated 9 comments.

Comment thread homeassistant/components/zwave_js/lock_helpers.py
Comment thread homeassistant/components/zwave_js/lock_helpers.py
Comment thread homeassistant/components/zwave_js/lock_helpers.py
Comment thread homeassistant/components/zwave_js/services.py
Comment thread homeassistant/components/zwave_js/lock.py
Comment thread tests/components/zwave_js/test_credential_services.py
Comment thread homeassistant/components/zwave_js/strings.json
max: 65535
step: 1
mode: box
user_name:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could be good to add, but not required.

Comment thread homeassistant/components/zwave_js/lock_helpers.py

@MartinHjelmare MartinHjelmare left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

Copilot AI review requested due to automatic review settings May 19, 2026 21:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 11 out of 11 changed files in this pull request and generated no new comments.

@MartinHjelmare
MartinHjelmare merged commit 9757f8b into home-assistant:dev May 20, 2026
49 checks passed
flz pushed a commit to flz/home-assistant that referenced this pull request May 20, 2026
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
@github-actions github-actions Bot locked and limited conversation to collaborators May 21, 2026
@AlCalzone
AlCalzone deleted the zwave-credentials branch June 15, 2026 06:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed has-tests integration: zwave_js new-feature Quality Scale: No score Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants