Skip to content

Conversation

@MartinHjelmare
Copy link
Member

Breaking change

Proposed change

  • Reload the config entry when receiving a driver ready event. A driver ready event is received, eg after updating the controller firmware, or restoring NVM to the controller.
  • Reloading the config entry is needed to clean out and update the stored model state in the client.
  • Before we only listened to the driver ready event when hard resetting the controller and when restoring controller NVM from inside Home Assistant. This isn't enough since the event can be triggered also from an outside source (like Z-Wave JS UI).

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

  • 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.

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 link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Aug 2, 2025

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 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 add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

Copy link
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

This PR fixes Z-Wave handling of driver ready events by ensuring config entries are reloaded when receiving a driver ready event from external sources (like Z-Wave JS UI). Previously, the integration only listened for driver ready events during specific operations like controller hard reset or NVM restore within Home Assistant.

  • Adds a global listener for driver ready events to reload config entries and clean stored client state
  • Consolidates driver ready event handling logic into a reusable helper function
  • Updates test expectations to reflect the new approach where config entry reloads happen automatically

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
homeassistant/components/zwave_js/__init__.py Adds global driver ready event listener to automatically reload config entries
homeassistant/components/zwave_js/helpers.py Adds new helper function for waiting on driver ready events and config entry reloads
homeassistant/components/zwave_js/const.py Moves DRIVER_READY_TIMEOUT constant to helpers.py as DRIVER_READY_EVENT_TIMEOUT
homeassistant/components/zwave_js/config_flow.py Updates to use new helper function for driver ready event handling
homeassistant/components/zwave_js/api.py Updates hard reset and NVM restore operations to use new helper function
tests/components/zwave_js/test_init.py Adds test for driver ready event handling
tests/components/zwave_js/test_config_flow.py Updates tests to use new constant location and adjusted call counts
tests/components/zwave_js/test_api.py Refactors tests to use proper async mocks and updated constant references

@MartinHjelmare MartinHjelmare added this to the 2025.8.0 milestone Aug 2, 2025
@MartinHjelmare MartinHjelmare merged commit fea5c63 into dev Aug 3, 2025
34 checks passed
@MartinHjelmare MartinHjelmare deleted the fix-zwave-driver-ready-listen branch August 3, 2025 09:23
@github-actions github-actions bot locked and limited conversation to collaborators Aug 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reload the config entry on all "driver ready" events, not only from things started by the integration

4 participants