Skip to content

Conversation

@raman325
Copy link
Contributor

@raman325 raman325 commented Feb 4, 2026

Breaking change

Proposed change

Migrate the Vizio integration to use a proper DataUpdateCoordinator for device state polling instead of custom polling logic.

This PR is the prequel to a future new PR to add a remote entity platform so that users can send remote keys to their device. Since remotes also require the is_on state, it made sense to move everything to a coordinator first.

This change:

  • Adds VizioDeviceCoordinator to handle device state updates
  • Uses runtime_data pattern instead of hass.data for storing device instance
  • Refactors VizioDevice to extend CoordinatorEntity
  • Adds VizioConfigEntry type alias for proper typing
  • Updates tests to work with the new coordinator pattern

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

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 diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copilot AI review requested due to automatic review settings February 4, 2026 06:20
Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

There is a merge conflict.

@home-assistant
Copy link

home-assistant bot commented Feb 4, 2026

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 force-pushed the vizio-device-coordinator branch from acf581b to 3d60cf6 Compare February 4, 2026 06:28
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 refactors the Vizio integration to use the standard DataUpdateCoordinator pattern instead of custom polling logic, improving code maintainability and consistency with Home Assistant best practices.

Changes:

  • Introduced VizioDeviceCoordinator to centralize device state polling and data management
  • Refactored VizioDevice entity to extend CoordinatorEntity and consume coordinator data
  • Migrated from hass.data storage to the runtime_data pattern with proper type hints via VizioConfigEntry type alias
  • Fixed test assertions to match actual behavior (volume calculations, sound mode handling, power state types)

Reviewed changes

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

Show a summary per file
File Description
homeassistant/components/vizio/__init__.py Creates device and coordinators during setup, uses runtime_data pattern for storing integration data
homeassistant/components/vizio/coordinator.py Adds new VizioDeviceCoordinator class to handle device state polling, device registry updates, and availability tracking
homeassistant/components/vizio/media_player.py Refactored entity to extend CoordinatorEntity, removed custom polling logic, processes coordinator data via callbacks
tests/components/vizio/conftest.py Updated mock paths from media_player to coordinator and init, added mock for get_current_app_config
tests/components/vizio/test_media_player.py Fixed test assertions (volume calculations, power state types), updated mock paths, corrected logging expectations

@raman325 raman325 marked this pull request as ready for review February 4, 2026 06:35
Copy link
Contributor

@epenet epenet left a comment

Choose a reason for hiding this comment

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

Please ensure that you use the new VizioConfigEntry in the coordinator typing

@home-assistant home-assistant bot marked this pull request as draft February 4, 2026 06:39
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

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

@raman325 raman325 marked this pull request as ready for review February 4, 2026 06:46
@home-assistant home-assistant bot requested a review from epenet February 4, 2026 06:46
Addresses PR review feedback:
- Move type definitions to coordinator.py to keep typing consistent
- Update coordinator classes to use VizioConfigEntry type
- Import VizioConfigEntry from coordinator (canonical location)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@raman325 raman325 force-pushed the vizio-device-coordinator branch from 04dd42d to 5f558f2 Compare February 4, 2026 14:21
Update async_get_options_flow to use VizioConfigEntry type.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
raman325 and others added 4 commits February 4, 2026 09:27
Move VizioConfigEntry and VizioRuntimeData to top of file
for better readability.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Move input list transformation to media_player platform.
API manipulation and transformation logic should live in
the platforms that consume them.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The None value is handled appropriately downstream.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Transform InputItem objects to strings in media_player.py
since API manipulation logic belongs in the consuming platform.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.

2 participants