Skip to content

[zwavejs] Fix Channel configuration overwrite #19036

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

Merged
merged 2 commits into from
Jul 25, 2025

Conversation

lsiepel
Copy link
Contributor

@lsiepel lsiepel commented Jul 24, 2025

Just before the release of this binding as part of openHAB 5, a bug was fixed that inadvertently revealed another, older one.

During Thing initialization, all channels were being re-created. Initially, this was fine, but when changing the configuration, the Thing would re-initialize and all channels—using their default configuration—would be re-created again, overwriting any configuration changes.

In short, the updateChannels method was refactored to perform only delta operations and leave existing channels untouched. As a side effect, binding initialization should now be faster, as channels typically do not change that often.

Should be backported to 5.0.x

Signed-off-by: Leo Siepel <[email protected]>
@lsiepel lsiepel requested review from a team and Copilot July 24, 2025 19:33
@lsiepel lsiepel added the bug An unexpected problem or unintended behavior of an add-on label Jul 24, 2025
Copy link

@Copilot 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 a bug in the Z-Wave JS binding where channel configurations were being overwritten during Thing re-initialization. The issue occurred when users changed channel configurations, but the Thing's re-initialization process would recreate all channels with default settings, discarding the user's customizations.

Key changes:

  • Refactored the updateChannels method to perform delta operations instead of recreating all channels
  • Added logic to preserve existing channels and only add/remove channels as needed
  • Improved documentation with detailed JavaDoc comments

Signed-off-by: Leo Siepel <[email protected]>
Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

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

LGTM, thank you

@lolodomo lolodomo merged commit a8ce93f into openhab:main Jul 25, 2025
2 checks passed
@lolodomo lolodomo added this to the 5.1 milestone Jul 25, 2025
@lsiepel lsiepel deleted the zwavejs-configuration-fix branch July 25, 2025 09:26
lsiepel added a commit that referenced this pull request Jul 25, 2025
* Rewrite updateChannels

Signed-off-by: Leo Siepel <[email protected]>
@lsiepel lsiepel added the patch A PR that has been cherry-picked to a patch release branch label Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on patch A PR that has been cherry-picked to a patch release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants