Skip to content

Add Plex play_media logging and troubleshooting tools#34412

Merged
balloob merged 3 commits into
home-assistant:devfrom
jjlawren:plex_play_with_key
Apr 23, 2020
Merged

Add Plex play_media logging and troubleshooting tools#34412
balloob merged 3 commits into
home-assistant:devfrom
jjlawren:plex_play_with_key

Conversation

@jjlawren
Copy link
Copy Markdown
Contributor

Proposed change

Many of the issues raised for the Plex component relate to the media_player.play_media service and (usually silent) failures. Many of these failures are networking setups or lack of client support, but it's always difficult to be certain. This PR adds a few things to improve troubleshooting abilities:

  1. Explicit logging when the client does not support playback controls.
  2. Logging of the specific media found immediately before playback is requested (in case nothing happens).
  3. Use of an improved exception in the plexapi library when media lookup fails.
  4. Accept a new media_content_type named "KEY". Instead of the existing escaped JSON required for media_content_id, this allows a user to specify a plain integer associated with the media by the Plex server. This can be found via Plex Web by going to Get Info -> View XML on the media and looking for ratingKey.

Existing style:

entity_id: media_player.plex_player
media_content_type: MUSIC
media_content_id: '{"library_name": "Music", "artist_name": "Stevie Wonder", "album_name": "Innervisions"}'

"Key" style:

entity_id: media_player.plex_player
media_content_type: KEY
media_content_id: 54

I do not intend to document the "key" style at the moment as its use is currently intended for troubleshooting purposes. However, this could become useful in the future if home-assistant/architecture#331 is implemented.

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

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

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.

If user exposed functionality or configuration variables are added/changed:

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

@MartinHjelmare MartinHjelmare changed the title Additional Plex play_media logging, troubleshooting tools Add Plex play_media logging and troubleshooting tools Apr 19, 2020
Comment thread homeassistant/components/plex/media_player.py Outdated
@jjlawren jjlawren force-pushed the plex_play_with_key branch from 2b429d5 to 2ac4f32 Compare April 22, 2020 21:25
Comment thread homeassistant/components/plex/media_player.py Outdated
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Good!

If you have time, please update the developer docs to mention this option. 👍

@jjlawren
Copy link
Copy Markdown
Contributor Author

Dev docs PR: home-assistant/developers.home-assistant#470

@jjlawren jjlawren added this to the 0.109.0 milestone Apr 23, 2020
MartinHjelmare pushed a commit to home-assistant/developers.home-assistant that referenced this pull request Apr 23, 2020
@balloob balloob merged commit f922128 into home-assistant:dev Apr 23, 2020
@jjlawren jjlawren deleted the plex_play_with_key branch April 24, 2020 02:50
@lock lock Bot locked and limited conversation to collaborators Apr 25, 2020
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.

4 participants