8000 Improve Plex device handling by jjlawren · Pull Request #48369 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve Plex device handling #48369

< 8000 div class="gh-header-actions mt-0 mb-3 mb-md-2 ml-1 flex-md-order-1 flex-shrink-0 d-flex flex-items-center gap-1">
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 5 commits into from
Mar 31, 2021

Conversation

jjlawren
Copy link
Contributor
@jjlawren jjlawren commented Mar 26, 2021

Breaking change

Devices representing Plex Web media_player devices will be removed. Any automations, scenes, or scripts based on the device will need to be changed to use the media_player entity.

Proposed change

This PR removes orphaned devices where the user has removed the associated media_player entity.

The method for assigning devices for certain Plex media_player entities is also changing. Plex Web and Plex for Sonos media_player entities represent potentially transient apps or external services. For example, a new Plex Web device is created for each browser login. These should not have permanent devices attached to them. This PR migrates the entities to a new shared "Plex Clients" service. This will also allow cleanup of the old individual devices during a subsequent restart.

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)
  • 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
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@jjlawren jjlawren changed the title Ignore and clean up transient Plex devices Clean up Plex devices, ignore transient devices Mar 26, 2021
@jjlawren jjlawren changed the title Clean up Plex devices, ignore transient devices Improve Plex device handling Mar 29, 2021
@jjlawren jjlawren marked this pull request as ready for review March 29, 2021 20:11
@@ -544,6 +545,15 @@ def device_info(self):
if self.machine_identifier is None:
return None

if self.device_product in TRANSIENT_DEVICE_MODELS:
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we just return None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I originally wanted to delete the current devices, but that also removed the associated entities. This moves them to a new service device instead so the old device can get safely removed by the new orphan cleanup code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BTW, I think I'd actually prefer to not have any devices attached to these entities, but returning None doesn't disassociate them from existing devices.

@balloob balloob merged commit be71d62 into home-assistant:dev Mar 31, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 1, 2021
@jjlawren jjlawren deleted the plex_ignore_transient_devices branch May 31, 2022 17:49
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 registry does not clean itself when no entity linked to it
3 participants
0