Media_player.play_media to Plex on LG WebOSTV does not work

Did you have to link this LG Plex client with a pin or login link?

Yep! Linked with the Link | Plex method and signed in with the admin user (me)

Did you customize the monitored users (or other options) in the Plex section on the Integrations page?

Nope

Is that the Plex server IP? Sometimes clients report their IP that way. Or is the TV connected to both wifi and ethernet and thatā€™s the other IP?

Since it seems like thereā€™s something a bit off in the data being returned by the Plex server, can you share the output of these two commands while the TV is playing?:


curl http://<PLEX_SERVER_IP>:32400/clients?X-Plex-Token=<TOKEN>
curl http://<PLEX_SERVER_IP>:32400/status/sessions?X-Plex-Token=<TOKEN>

Make sure to remove your token before posting.

Nope, that IP isnā€™t actually in use, as far as I can tell. Just confirmed the TV is .183 and the server is .220. Everything on my network has a reserved IP higher than 149. Pinging 10.0.1.141 gives a timeout, as I would expect

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="2">
<Server name="Chrome" host="10.0.1.220" address="10.0.1.220" port="32400" machineIdentifier="ri6i5o0z88msj6crmxkcldma" version="4.22.3" protocol="plex" product="Plex Web" deviceClass="pc" protocolVersion="3" protocolCapabilities="timeline,playback,navigation,mirror,playqueues" />
<Server name="LG OLED55B9PUA" host="10.0.1.220" address="10.0.1.220" port="32400" machineIdentifier="qmhey9cn2jyn2eutlpr7kkeq" version="4.29.2" protocol="plex" product="Plex for LG" deviceClass="pc" protocolVersion="3" protocolCapabilities="timeline,playback,navigation,mirror,playqueues" />
</MediaContainer>
<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="1">
<Track addedAt="1323392753" art="/library/metadata/45672/art/1570010193" duration="111804" grandparentArt="/library/metadata/45672/art/1570010193" grandparentGuid="com.plexapp.agents.plexmusic://gracenote/artist/05BA9F4000413157?lang=en" grandparentKey="/library/metadata/45672" grandparentRatingKey="45672" grandparentThumb="/library/metadata/45672/thumb/1570010193" grandparentTitle="Simon &amp; Garfunkel" guid="com.plexapp.agents.plexmusic://gracenote/track/4272471-BA9F40B07E30FD01221BECF5EF73A603/4272480-B18B8B92E5ADAD9463612BBCC0E76340?lang=en" index="9" key="/library/metadata/45682" lastViewedAt="1574093920" librarySectionID="1" librarySectionKey="/library/sections/1" librarySectionTitle="Music" originalTitle="Simon &amp; Garfunkel" parentGuid="com.plexapp.agents.plexmusic://gracenote/album/05BA9F4000413157/4272471-BA9F40B07E30FD01221BECF5EF73A603?lang=en" parentIndex="1" parentKey="/library/metadata/45673" parentRatingKey="45673" parentThumb="/library/metadata/45673/thumb/1491802821" parentTitle="Sounds of Silence" ratingCount="833541" ratingKey="45682" sessionKey="168" summary="" thumb="/library/metadata/45673/thumb/1491802821" title="April Come She Will" type="track" updatedAt="1565400708" viewCount="8" viewOffset="19000">
<Media audioChannels="2" audioCodec="mp3" bitrate="160" container="mp3" duration="111804" id="41933" selected="1">
<Part container="mp3" duration="111804" file="/nas/music/Music/Simon &amp; Garfunkel/Sounds of Silence/09 April Come She Will.mp3" hasThumbnail="1" id="118545" key="/library/parts/118545/1323392753/file.mp3" size="2321212" decision="directplay" selected="1">
<Stream albumGain="-0.74" albumPeak="0.707672" albumRange="8.020374" audioChannelLayout="stereo" bitrate="160" channels="2" codec="mp3" displayTitle="Unknown (MP3 Stereo)" gain="-0.74" id="172130" index="0" loudness="-22.17" lra="8.93" peak="0.458740" samplingRate="44100" selected="1" streamType="2" location="direct" />
</Part>
</Media>
<Mood filter="mood=289" id="289" tag="Tender" />
<Mood filter="mood=170" id="170" tag="Sincere" />
<User title="" />
<Player address="10.0.1.183" device="" machineIdentifier="qmhey9cn2jyn2eutlpr7kkeq" model="OLED55B9PUA" platform="webOS" platformVersion="4.7.0" product="Plex for LG" remotePublicAddress="184.60.220.198" state="playing" title="LG OLED55B9PUA" vendor="" version="4.29.2" local="1" relayed="0" secure="0" userID="1" />
<Session id="ejy8otmy0mu4sd9cd3au0yo7" bandwidth="336" location="lan" />
</Track>
</MediaContainer>

Itā€™s definitely playing, but the HA state is still listed as idle

Very interestingly, it says <User title="" />, but Iā€™m logged in on that plex client with my admin user. The full User information shows up when using any other client. And I just double checked, I am monitoring all users including guests

Okay, I found a solution that makes the user show up and everything appears to be working correctly with HA and Plex together:

I had a ā€œmanual serverā€ configured in the Plex client. Removed that. All fixed. Odd. Seems to be a Plex issue.

Except: media_player.play_media still does nothing. No error or anything.

Awesome, nice work figuring it out! That was not near the top of my list of ideas. Plex is tricky with odd behaviors like this and every client seems to behave just a little differently from the others.

Iā€™ll see if I can handle this weird edge case somehow.

Iā€™m pretty sure the play_media fix in 0.108 will help here if youā€™re already able to pause/play this client. Please let me know if it doesnā€™t.

1 Like

Thanks again! Iā€™ll check back in when 108 is out

Updated to 108.2 this morning (skipped .0 and .1) and Iā€™m still unable to play media from service calls.

Do you know off-hand how I can trigger the call directly with curl or something, to rule out HA as the issue?

Iā€™ll try to test with a WebOS Plex client sometime this weekend.

As a sanity check, have you installed another Plex custom component?

What do you mean by custom component?

Iā€™m only using plex installed from the integrations UI. I have a few clients and others work correctly when calling the play_media service

There are integrations from outside of what ships with HA, and sometimes they can cause conflicts or weird behavior. Just making sure that wasnā€™t a possibility first.

1 Like

Okay, good and bad news. I tested with an LG TV running Plex 4.29.2. Using 0.108.X I wasnā€™t able to get the media to play, either. Iā€™m still digging into exactly why.

However, when I tested with my current HA dev branch against the unreleased version of plexapi (the underlying library) then I was able to play media fine.

If itā€™s something I can fix in HA without a new library version then Iā€™ll try to get it into a bug release. Otherwise it looks like itā€™ll be fixed in 0.109 if we can get a new plexapi release pushed out before then.

1 Like

ā€¦and of course as soon as Iā€™m able to test again to gather more info it starts working on 0.108.3. Itā€™s working on movies, TV shows, music, etc.

Not sure what I can suggest besides trying again. Perhaps give the TV a power cycle to make sure itā€™s not stuck in a bad state?

1 Like

Updated to 0.108.3 and still not working. TV is on, Plex is running, and I can see its status in HA (idle).

Iā€™ve tried EPISODE, VIDEO, and MUSIC content types with appropriate content id JSON and nothing will play.

Iā€™m looking through my Plex serverā€™s debug logs, but I donā€™t see any request based on my random artist/title/etc showing up in its logs, so I donā€™t think itā€™s ever reaching the server. Itā€™s also now the same for a Roku TV that I have.

There are no errors or log warnings in HA about the service requests either.

Sorry, Iā€™m not quite sure what the current issue is. If youā€™re able to play/pause but you arenā€™t seeing any errors or warnings then it means the play_media request is being sent to the client and itā€™s not acting on it for some reason.

I hope to upgrade the plexapi library for 0.109 which should make things more consistent. Itā€™s not available yet but I continue to push.

Iā€™m also going to add a bit more logging to make this more visible and eliminate silent failures.

1 Like

No worries! Thanks again for all the help

1 Like

Hey @paulstronaut have you tried 0.109 yet? It has the new plexapi version and better (debug) logging for troubleshooting playback.

1 Like

Updated, but havenā€™t had a chance to test yet. Hopefully in the next couple of days!

1 Like

Itā€™s working!

Thank you so much for all of the help, support, and work on this @jjlawren

1 Like