Skip to content
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

Don't remove zwave_js devices automatically #98145

Merged
merged 17 commits into from
Jan 30, 2024
Merged

Conversation

raman325
Copy link
Contributor

@raman325 raman325 commented Aug 10, 2023

Breaking change

Home Assistant Devices that represent Z-Wave JS nodes will persist even after the node has been removed. If the node has been removed, you can manually delete the device entry, but note that you will be unable to do so if the node is still known to the controller

Proposed change

Due to issues reported in #80398 where the unique identifiers we use for devices randomly change, the integration was removing devices and recreating them, causing users to lose their entity customizations. To address this, when a node is being (re)registered in the device registry, if there is an existing device that has this node ID but has a different hardware based identifier, we will keep the old device and add a new one with the new hardware based identifier. This will allow a node to reassociate with the first device if the hardware signature changed because of an error and is later corrected. Additionally, users can remove the old device manually if it shouldn't be there.

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 Black (black --fast 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.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

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.

@raman325 raman325 marked this pull request as draft August 10, 2023 07:11
@MartinHjelmare
Copy link
Member

I don't think this is the solution. We're able to know when devices have been removed and the mentioned problem is not affecting most users. I think we should find the cause and fix that, not workaround it by degrading to manual remove of devices.

@MartinHjelmare
Copy link
Member

Reading the PR code, we're still removing the devices that are not known to the controller. It's just the replacement removal of devices with changed metadata that has been removed. The PR description needs to be clarified. I'm more positive about this change.

@raman325
Copy link
Contributor Author

raman325 commented Aug 13, 2023

yes the scope of this PR changed mid flight. Still trying to figure out what to do long term which is why this is still in draft. With that being said, I've updated the PR description to be less confusing

Copy link

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 11, 2023
@raman325
Copy link
Contributor Author

still valid

@github-actions github-actions bot removed the stale label Nov 12, 2023
* upstream/dev: (2071 commits)
  Set zwave_js voltage sensor suggested precision (home-assistant#107116)
  Bump bluetooth-adapters to 0.17.0 (home-assistant#107195)
  Disable IPv6 in the opower integration to fix AEP utilities (home-assistant#107203)
  Fix conversation snapshots (home-assistant#107196)
  Report missing entities/areas instead of failing to match in Assist (home-assistant#107151)
  Bump to PyTado 0.17.3 (home-assistant#107181)
  Fix switch states in AVM FRITZ!Box Tools (home-assistant#107183)
  Fix tplink overloading power strips (home-assistant#104208)
  Update sensorpush-ble library to 1.6.1 (home-assistant#107168)
  Bump aiohomekit to 3.1.2 (home-assistant#107177)
  Introduce base entity in streamlabs water (home-assistant#107095)
  Clean up outdated entity replacement logic in Guardian (home-assistant#107160)
  Add conversation_id parameter to conversation.process service (home-assistant#106078)
  Pass aiohttp clientsession to tedee integration (home-assistant#107089)
  Update Home Assistant base image to 2024.01.0 - Python 3.12 (home-assistant#107175)
  Remove precision in streamlabs water (home-assistant#107096)
  Pass down language to hassil (home-assistant#106490)
  Use snapshots in Glances sensor tests (home-assistant#107159)
  Cache homekit_controller supported features (home-assistant#106702)
  Migrate AVM FRITZ!Box Call monitor to has entity name (home-assistant#99752)
  ...
@raman325 raman325 removed the small-pr PRs with less than 30 lines. label Jan 5, 2024
@raman325 raman325 marked this pull request as ready for review January 5, 2024 08:42
homeassistant/components/zwave_js/__init__.py Show resolved Hide resolved
homeassistant/components/zwave_js/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/zwave_js/__init__.py Outdated Show resolved Hide resolved
tests/components/zwave_js/test_init.py Outdated Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft January 5, 2024 18:16
@home-assistant
Copy link

home-assistant bot commented Jan 5, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@raman325 raman325 marked this pull request as ready for review January 6, 2024 00:59
@raman325 raman325 dismissed MartinHjelmare’s stale review January 6, 2024 07:10

review comments addressed

@home-assistant home-assistant bot marked this pull request as draft January 29, 2024 11:41
@raman325 raman325 marked this pull request as ready for review January 29, 2024 21:23
@MartinHjelmare
Copy link
Member

Thanks!

@raman325 raman325 merged commit 18d3958 into home-assistant:dev Jan 30, 2024
23 checks passed
@raman325 raman325 deleted the device branch January 30, 2024 02:36
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2024
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.

ZwaveJS Renames Devices on HA Restart
2 participants