Skip to content

Support device removal in CoolMasterNet integration #147851

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 1 commit into from
Jul 1, 2025

Conversation

OnFreund
Copy link
Contributor

@OnFreund OnFreund commented Jul 1, 2025

Proposed change

Allow device removal in CoolMasterNet.

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:

Copy link
Contributor

@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

Adds support for removing devices that are no longer reported by the CoolMasterNet integration.

  • Introduces async_remove_config_entry_device hook to automatically unregister disconnected units.
  • Adds a registry cleanup test to verify live devices cannot be removed and dead devices are pruned.

Reviewed Changes

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

File Description
tests/components/coolmaster/test_init.py Added test_registry_cleanup to validate removal behavior for live vs. dead devices.
homeassistant/components/coolmaster/init.py Implemented async_remove_config_entry_device hook and imported DOMAIN and device_registry.
Comments suppressed due to low confidence (1)

homeassistant/components/coolmaster/init.py:59

  • Clarify that this hook returns True when a device should be removed (i.e., no longer present in runtime_data.data) and False otherwise. For example: """Return True if the device is no longer reported by the integration and can be removed."""
    """Remove a config entry from a device."""

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @OnFreund 👍

../Frenck

@frenck frenck merged commit ddf56f0 into home-assistant:dev Jul 1, 2025
34 checks passed
@OnFreund OnFreund deleted the remove_device branch July 1, 2025 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot delete devices from Integration
2 participants