Oh that is a very interesting idea! I will look into it. Would you mind creating a feature request via issues on github?
Does this mean I need to run a local plex instance to ‘route’ the stream to local plex clients?
Add information about your local Plex server which sees your device on which you wish to play content. This is done by including a new key, “server” having additional keys:
Sure, just opened the FR on github [Feature Request] Plex Smart Collections · Issue #28 · JurajNyiri/PlexMeetsHomeAssistant · GitHub
as mentioned there, I’m open for testing if you need anybody
You can add server from which you want to use target devices into plexPlayer.
Yes, if your remote server doesnt see your local devices, you need to have a server which sees them, or use cast/androidtv/kodi.
2.1 has been released
New Features
- Ability to use playlists as a library
- Ability to use collections as a library
HI Ive been playing with for a few days now, can you get it to Display content but get get the play function working. I have noticed that most people have a local Plex server, However I have a remote server should the play function still work?
Yes, through kodi/android TV/cast without additional setup. For plexPlayer check readme and detailed configuration. You will need to set it up manually through code config.
Stupid question. would it be possibel to use url iso ip for also external access?
Yes it is possible
Found it
Does not work through configuration UI because of plexPlayer key
type: 'custom:plex-meets-homeassistant'
token: QWdsqEXAMPLETOKENqwerty
ip: remote.plex.server.com # remote shared plex instance
port: 443
libraryName: Deck
protocol: https
maxCount: 10
sort: title:desc
runBefore: script.turn_on_tv_and_wait
runAfter: script.movie_time
showExtras: true
playTrailer: muted
entity:
kodi:
- media_player.kodi_bedroom
- media_player.kodi_living_room
androidtv:
- media_player.living_room_nvidia_shield
- media_player.bedroom_nvidia_shield
- media_player.kithen_nvidia_shield
plexPlayer:
- identifier: TV 2020 # plex client device located on local plex server network
server:
ip: local.plex.server.com # Mandatory
token: QWdsqEXAMPLETOKENqwerty # Mandatory
port: 32400
protocol: http
- 192.168.13.50 # without definition for server, it will look for device on remote.plex.server.com network
cast: media_player.bedroom_tv
Is it possible to have shuffle as an option?
Say I’m playing a playlist, it starts from the first each time. Can the shuffle be enacted?
Currently no, please open a new feature request on github.
hey,
Has anyone found issues with the script run before play media? i can not seem to get it to wait long enough for plex to start. it seems to me it will wait approximately 10 seconds before it try’s to play media but this is not long enough for the tv to startup and the app. if i try to change the delay time to 1 min i still get the error message on homeassistant after 10 seconds.
i keep getting the error Failed to call service rest_command/pmha_playmedia. Service not found
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.
i agree, i think it is play device not being ready. however even though i have set up a wait time of 40 seconds in a script i am running before media is played i still get the error approx 10 seconds after pressing playing. it seems to me it is trying to play without waiting the full 40 seconds.
You can try executing the script yourself. Card executes the script, waits for it to finish and then run whatever play action it needs.
i changed my script to turn on a light after the wait time it works fine when i run the script myself.
So when running the script in run_before it only waits for 10 seconds at most?
yes that is correct