Closed nathanmfast closed 2 years ago
Hey!
I need to document this, this is an undocumented workaround for some issues that were fixed long time ago.
await this.hass.callService('rest_command', 'pmha_playmedia', {
// eslint-disable-next-line @typescript-eslint/camelcase
url,
// eslint-disable-next-line @typescript-eslint/camelcase
target_client_identifier: machineID,
// eslint-disable-next-line @typescript-eslint/camelcase
client_identifier: 'PlexMeetsHomeAssistant'
});
It is called when the usual request from card to plex server fails. You can create a rest_command:
rest_command:
pmha_playmedia:
url: "{{ url }}"
headers:
X-Plex-Target-Client-Identifier: "{{ target_client_identifier }}"
X-Plex-Client-Identifier: "{{ client_identifier }}"
in your config and restart. I am 99.9% sure that it will not help as that just does the same thing card does, but from Home Assistant instead (can ignore http vs https issues).
Issue is most probably somewhere else - most probably play device not being available at that time.
First thing to try is using UI editor to set up the card. That does resolve a lot of possible human errors.
If you want to dig further, try to look into playQueues requests, those should give you more information as to what went wrong.
Do I paste it in just like that? Or is there a url / target_client_identifier / client_identifier I need to plug in? I tried this and it made the error message go away but the show doesn't play on the specified player when I click the play button.
Is that error coming from Plex itself and not Home Assistant?
If its coming from Home Assistant:
I configured using the UI configurator and got what I believe is the same error:
I can't tell if this is coming from Plex or Home Assistant. I'll create a proper ticket for it but without knowing where its coming from I'm not sure if I should or not. How could I tell? It seems to be coming from Plex, but maybe it's an issue with url for the request?
If I select the web player for Plex it works, but if I select Plex Media Player it does not.
Also, I'm on https for plex but only http for Home Assistant, but if that matters I'm not sure why it doesn't for the web player. I just noticed questions about this in the bug template so thought I'd add that info. Also your suggestion earlier involved adding something to configuration.yaml so that ignore http vs https issues. I copy/pasted that exactly as-is into the configuration.yaml. To be clear earlier, the "Failed to call service rest_command/pmha_playmedia. Service not found." error message in the UI went away, but network call failed identically before/after that configuration change.
It looks like it's coming from Plex. I haven't seen an error like this before, usually when there is an error plex just returns 400 or 500 and logs error internally into log.
https plex and http Home Asssistant is fine. The other way is the issue, so no problem there.
The error gone away after pasting into configuration.yaml because now the service exists, but it does the same request which errors out now too.
You could try checking plex logs... in troubleshooting section you can download them. See if there is something that would tell us more 🤔
I was able to follow the "Machine ID setup" on Detailed configuration instructions for end devices to connect to Plex running in a browser on my desktop and start playing shows on it, but when I try to do the same for the entry I have for the instance of "Plex Media Player" I have running on that same desktop, I get an error:
Trying to dig a littler, I found that one of the network calls came back with:![image](https://user-images.githubusercontent.com/5238018/131237349-6f844ecb-8a8f-4d4a-888b-78675de1cae0.png)