#Mediocre Media Player hide custom buttons with template (or similar)

1 messages · Page 1 of 1 (latest)

supple owl
#

I'm using Mediocre Media Player and have a Custom Button I'd only like to display at certain times (in this instance, a Christmas Playlist which only shows up in December). I've tried states directly, I've now added a Helper Sensor which works to hide the entire card, but not just one of the Custom buttons.

Helper Sensor

template:
  - sensor:
      - name: "Month"
        state: "{{ now().month }}"

Works for the whole card

visibility:
  - condition: state
    entity: sensor.month
    state: "12"

Doesn't work for Custom Button

  - name: Christmas
    icon: mdi:pine-tree
    show_if_template: "{{ states('sensor.month') == '12' }}"
    tap_action:
      action: perform-action
      perform_action: music_assistant.play_media
      target:
        device_id: 94e5f5a9771526e81a6aac7bc1fdcf89
      data:
        media_id: Christmas
        media_type: playlist
shut tapir
#

Use a Conditional Card to display / hide the Custom button Card:

type: conditional
conditions:
  - condition: state
    entity: sensor.month
    state: 12
card:
  type: custom:button-card  
  name: Christmas
  icon: mdi:pine-tree
  tap_action:
    action: perform-action
    perform_action: music_assistant.play_media
    target:
      device_id: 94e5f5a9771526e81a6aac7bc1fdcf89
    data:
      media_id: Christmas
      media_type: playlist
supple owl
#

That's a full Conditional Card, not a Custom Button on a Mediocre Media Player, unfortunately. I've read through the Github for Mediocre Media Player and I don't think it's possible. The Custom Buttons on it only supports the Action, Name and Icon 🙁

#

As a workaround, I'm just going to build the entire card twice; with and without the Christmas playlist and hide/show as needed

shut tapir
#

That sounds like a sensible workaround, although you should make a feature request on Github.