kalkih / mini-media-player

Minimalistic media card for Home Assistant Lovelace UI
MIT License
1.51k stars 206 forks source link

tap_action play_pause #594

Closed spencerthayer closed 2 years ago

spencerthayer commented 2 years ago

Is there a way to use the tap_action to engage in a play_pause?

kalkih commented 2 years ago

Yes, you can configure it to call any service, see action-object-options.

spencerthayer commented 2 years ago

I appreciate the response @kalkih but I am unclear how to play or pause. The following configuration below is intended to be just the song album cover with no additional controls besides playing and pausing on a tap_action. However, it's not working. Any assistance would be appreciated.

type: conditional
conditions:
  - entity: media_player.living_room
    state_not: 'off'
card:
  type: custom:mini-media-player
  artwork: full-cover
  group: false
  hide_when_off: false
  scale: '1'
  tap_action:
    action: play_pause
  hide:
    artwork_border: true
    controls: true
    icon_state: true
    icon: true
    info: true
    jump: true
    mute: true
    name: true
    next: true
    play_pause: true
    play_stop: true
    power_state: true
    power: true
    prev: true
    progress: true
    repeat: true
    runtime_remaining: true
    runtime: true
    shuffle: true
    sound_mode: true
    source: true
    state_label: true
    volume_level: true
    volume: true
  idle_view:
    when_idle: true
    when_standby: true
  entity: media_player.living_room
kalkih commented 2 years ago

Hello again, Please try the following:

tap_action:
  action: "call-service"
  service: media_player.media_play_pause
  service_data:
    entity_id: media_player.living_room
spencerthayer commented 2 years ago

That did it. Thanks!