piitaya / lovelace-mushroom

Build a beautiful Home Assistant dashboard easily
Apache License 2.0
3.61k stars 332 forks source link

[Feature]: Add Input Select for Source to Media card #967

Open kbrown01 opened 1 year ago

kbrown01 commented 1 year ago

Requirements

Is your feature request related to a problem?

Mini Media player does it right, Mushrrom lacks one key component ... selecting the source

Describe the solution you'd like

Now we have a mushroom select card (great!) how about adding similar functionality to the mushroom media card?

Describe alternatives you've considered

No response

Additional context

No response

kbrown01 commented 1 year ago

See https://github.com/piitaya/lovelace-mushroom/discussions/966

tmilner commented 1 year ago

I hope this can be added soon (given there is an open PR for it) 😄 For me it would be very useful.

olig89 commented 1 year ago

Just chipping in to say this would complete my mushroom load-out, hope it gets covered soon!

kbrown01 commented 1 year ago

Just FYI, I did mine like this using a layout card with mushroom media player and mushroom select.

  - type: custom:auto-entities
    card:
      type: grid
      columns: 1
      show_header_toggle: false
      state_color: true
      square: false
      title: Music Zones
    card_param: cards
    filter:
      template: >
        {% for MEDIAPLAYER in states.media_player |
        selectattr("entity_id","in",integration_entities("xantech")) -%}
          {% set SELECTZONE = "input_select.dax_source_" + (MEDIAPLAYER.entity_id).split("xantech8_")[1]
        -%}
          {% if MEDIAPLAYER.entity_id != "media_player.xantech8_xantech_house_audio"
        -%}
            {{
              {
                'type': 'custom:layout-card',
                'layout_type': 'custom:grid-layout',
                'layout': {
                  'max_cols': 3,
                  'grid-template-columns': 'auto 150px'
                },
                'cards': [
                {
                  'type': 'custom:mushroom-media-player-card',
                  "tap_action": {
                      "action": "call-service",
                      "service": "media_player.toggle",
                      "target": {"entity_id": MEDIAPLAYER.entity_id}
                  },
                  'entity': MEDIAPLAYER.entity_id,
                  'layout': 'horizontal',
                  'fill-container': true,
                  'show_volume_level': true,
                  'collapsible_controls': false,
                  'use_media_info': true,
                  'volume_controls': ['volume_set']
                },
                {
                    "type": "custom:mushroom-select-card",
                    "entity": SELECTZONE,
                    "name": "Set Zone Sources",
                    "layout": "horizontal",
                    "icon_type": "none",
                    "primary_info": "none",
                    "secondary_info": "none",
                }
              ]}
            }},
          {%- endif %}
        {%- endfor %}

Works quite well.

Screenshot 2023-08-15 104829