Skip to content

Add support for dynamic nest devices and remove stale devices#159060

Merged
joostlek merged 2 commits intohome-assistant:devfrom
allenporter:nest
Dec 15, 2025
Merged

Add support for dynamic nest devices and remove stale devices#159060
joostlek merged 2 commits intohome-assistant:devfrom
allenporter:nest

Conversation

@allenporter
Copy link
Copy Markdown
Contributor

@allenporter allenporter commented Dec 15, 2025

Proposed change

Update the nest integration to dynamically add and remove devices. Nest publishes a pubsub event when the devices change and the list of devices is refreshed.

Update the quality scale to match the new functionality. This includes marking existing device support as complete.

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 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:

Update the nest integration to dynamically add and remove devices. Nest publishes a pubsub event when the devices change and the list of devices is refreshed.

Update the quality scale to match the new functionality. This includes marking existing device support as complete.
Copy link
Copy Markdown
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 adds dynamic device management to the Nest integration, enabling automatic addition of newly discovered devices and removal of stale devices that no longer exist. The integration now listens for device changes from the Nest API and updates the Home Assistant device registry accordingly.

Key changes:

  • Implemented a callback-based listener pattern for device additions across all platforms (sensor, climate, camera)
  • Added automatic stale device cleanup when devices are no longer returned by the Nest API
  • Updated quality scale to mark devices, stale-devices, and dynamic-devices as complete

Reviewed changes

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

Show a summary per file
File Description
homeassistant/components/nest/__init__.py Implements device listener registration and callback system; handles dynamic device addition and stale device removal
homeassistant/components/nest/types.py Adds type definitions for device listener callbacks
homeassistant/components/nest/sensor.py Migrates from direct device iteration to listener-based pattern
homeassistant/components/nest/climate.py Migrates from direct device iteration to listener-based pattern
homeassistant/components/nest/camera.py Migrates from direct device iteration to listener-based pattern
homeassistant/components/nest/quality_scale.yaml Updates quality scale rules to mark device-related features as complete
tests/components/nest/test_init.py Adds comprehensive tests for dynamic device addition and stale device cleanup
tests/components/nest/test_events.py Updates comment to reflect new automatic entity registration behavior

Comment thread tests/components/nest/test_init.py Outdated
Comment thread homeassistant/components/nest/__init__.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@joostlek joostlek merged commit 2679ac3 into home-assistant:dev Dec 15, 2025
36 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 16, 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.

Device not removed from Google Nest integration

3 participants