Starting Plex with Android Intents
I have a Home Assistant automation setup at home, and for Christmas I really wanted a button that would turn on all my lights into a specific cosy configuration, switch the tree on, start some Christmas music, but also play a log fire video on my TV. Most of this was easy to achieve, but getting Plex to automatically play a video took a bit of sleuthing...
Ultimately, you need this command:
am start --ez "android.intent.extra.START_PLAYBACK" true -a android.intent.action.VIEW 'plex://server://{SERVERID}/com.plexapp.plugins.library/library/metadata/{LIBRARY_ID}'
Important things to replace:
{SERVERID}
Replace with your server's ID.
When browsing Plex using https://app.plex.tv/desktop, you will see it after "/server/"
{LIBRARY_ID}
The library item's ID you wish to play.
When browsing Plex in-browser, go to "Get Info".
Go to "View XML"
Look for the RatingKey, this is your library item's ID.