I’ve been trying to setup a Universal Media Player for a while now and have everything working except for the Play/Pause functionality. I have tried various different configurations, but just cannot get this to work as expect. I currently have a script that sends the pause function to the required device depending on what I am watching (TiVo, AppleTV, Smart TV, etc). This script is working without issue. The issue is coming from trying to execute this script via the universal media player. The documentation, unfortunately, doesn’t call out the play/pause functionality, but the code seems to indicate it should work. Is there something specific that needs to be done for this?
Can you please paste your correctly formatted configuration for the player?
Here is the current configuration. It has gone through a few iterations, but nothing has worked in the past.
media_player:
- platform: universal
name: TV
device_class: tv
children:
- media_player.living_room_receiver
attributes:
state: remote.living_room_hub
source_list: remote.living_room_hub|activity_list
source: remote.living_room_hub|current_activity
volume_level: media_player.living_room_receiver|volume_level
is_volume_muted: media_player.living_room_receiver|is_volume_muted
commands:
turn_on:
service: remote.turn_on
target:
entity_id: remote.living_room_hub
turn_off:
service: remote.turn_off
target:
entity_id: remote.living_room_hub
volume_up:
service: media_player.volume_up
data:
entity_id: media_player.living_room_receiver
volume_down:
service: media_player.volume_down
data:
entity_id: media_player.living_room_receiver
volume_set:
service: media_player.volume_set
data_template:
entity_id: media_player.living_room_receiver
volume_level: '{{ volume_level }}'
volume_mute:
service: media_player.volume_mute
data_template:
entity_id: media_player.living_room_receiver
is_volume_muted: '{{ is_volume_muted }}'
media_play_pause:
service: script.pause_living_room_tv
That looks ok.
Have you tried specifying separate media_play
and media_pause
options instead?
I have tried that as well, but still getting nothing. This script does work without issue when ran alone. Does play/pause need an attribute similar to ‘is_volume_muted’? I just thought of that.
It’s definitely worth a try. Unfortunately I don’t have access to GitHub at the moment so I can’t check the source.
Looking at the code, there doesn’t appear to be an ‘is_paused’ type of property from what I can tell at least. Been banging my head against a wall on this one for a bit and it doesn’t seem like a lot of people use the universal media player component from searching around.
Hi,
Paused is a state of media player like idle, on, off…
@dragonpark - I had the same issue, and could not figure out why play+pause would not work. After leaving it for a while I found this post and took @tom_l suggestion and viola it worked.
media_play_pause:
service: media_player.media_play_pause
data:
entity_id: media_player.study_foobar_server
then I changed it to
media_play:
service: media_player.media_play_pause
data:
entity_id: media_player.study_foobar_server
media_pause:
service: media_player.media_play_pause
data:
entity_id: media_player.study_foobar_server