Skip to content
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

Bug: Failed to call service rest_command/pmha_playmedia. Service not found #82

Open
rdmitre opened this issue Apr 16, 2022 · 4 comments
Assignees

Comments

@rdmitre
Copy link

rdmitre commented Apr 16, 2022

Whenever I play anything a toast notification pops up: Failed to call service rest_command/pmha_playmedia. Service not found

Steps to reproduce the behavior:
I just installed the repo through HACS and set up the card through Yaml file.
The error occurs every time I play anything.
The media plays without any issue, just an annoying error message to see every time.

Please check below if true:

[x ] I am running Home Assistant on HTTP protocol
[ ] I am running BOTH Home Assistant AND Plex on HTTPS protocol
[ x] My Plex server is accessible through protocol, port and ip/hostname I have specified for the card.
[ ] My Plex server is running on HTTPS and has a valid certificate.

        - type: 'custom:plex-meets-homeassistant'
          token: !secret plex_token
          ip: !secret plex_host
          port: 32400
          libraryName: Películas
          protocol: http
          sort: title:desc
          entity:
            plexPlayer:
              - identifier: Roku de Sofia
              - identifier: Roku de Dario

Card Version
3.6.3

Plex Version
1.25.2.5319 (QNAP NAS Version)

@JurajNyiri
Copy link
Owner

Please follow steps here and provide needed information: #49

@peledzius
Copy link

I'm experiencing this too on Android tablet. It happens when I start Plex app on TV and then I try to cast movie from the card. If I refresh my Lovelace view, it doesn't throw error anymore.

Error from DevTools:

<?xml version='1.0' encoding='utf-8'?>
<Response code="2000" status="KeyError: X-Plex-Target-Client-Identifier">
  <Traceback>Traceback (most recent call last):
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-8cf78dab3/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/runtime.py", line 843, in handle_request
    result = f(**d)
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-8cf78dab3/System.bundle/Contents/Code/playerservice.py", line 19, in process_remote_command
    identifier = Request.Headers['X-Plex-Target-Client-Identifier']
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-8cf78dab3/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 108, in &lt;lambda&gt;
    _getitem_           = lambda x, y: x.__getitem__(y),
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-8cf78dab3/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/tornado/httputil.py", line 113, in __getitem__
    return dict.__getitem__(self, HTTPHeaders._normalize_name(name))
KeyError: 'X-Plex-Target-Client-Identifier'
</Traceback>
</Response>

I investigated that X-Plex-Target-Client-Identifier header is sent empty:

image

I assume that the card doesn't know if Plex client became available unless you refresh page. And that's also why play button never shows up when hovered above poster until you refresh page.

@JurajNyiri JurajNyiri mentioned this issue Apr 14, 2023
Closed
@blamaz
Copy link

blamaz commented Oct 4, 2023

Same error here

@blamaz
Copy link

blamaz commented Feb 16, 2024

Strangely when I hit play on any video this error "Failed to call service rest_command/pmha_playmedia. Service not found" appear on the screen but the video start playing just fine. If i add the following to my configuration.yaml, the error dissapeared.

rest_command:
  pmha_playmedia:
    url: "{{ url }}"
    headers:
      X-Plex-Target-Client-Identifier: "{{ target_client_identifier }}"
      X-Plex-Client-Identifier: "{{ client_identifier }}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants