Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to filter media_player domain #9

Closed
pironic opened this issue Mar 8, 2019 · 10 comments
Closed

Unable to filter media_player domain #9

pironic opened this issue Mar 8, 2019 · 10 comments

Comments

@pironic
Copy link

pironic commented Mar 8, 2019

looks as though i can't set my card type to anything like 'media-control' or 'custom:mini-media-player' because

mini-media-player Error: Specify an entity from within the media_player domain.
    at HTMLElement.setConfig (mini-media-player-bundle.js?v=1.0.2:1)
    at _createThing (card-tools.js?track=true&v=0:82)
    at Function.createThing (card-tools.js?track=true&v=0:112)
    at Function.createCard (card-tools.js?track=true&v=0:133)
    at HTMLElement.setConfig (auto-entities.js?v=be1323:12)
    at create_card_element_createElement (401352253e833b70a294.chunk.js:4823)
    at createCardElement (401352253e833b70a294.chunk.js:4823)
    at HTMLElement.createCardElement (401352253e833b70a294.chunk.js:5614)
    at config.cards.forEach (401352253e833b70a294.chunk.js:5693)
    at Array.forEach (<anonymous>)

or

hui-media-control-card Error: No entity specified
    at HTMLElement.setConfig (401352253e833b70a294.chunk.js:3896)
    at _createThing (card-tools.js?track=true&v=0:82)
    at Function.createThing (card-tools.js?track=true&v=0:112)
    at Function.createCard (card-tools.js?track=true&v=0:133)
    at HTMLElement.setConfig (auto-entities.js?v=be1323:12)
    at create_card_element_createElement (401352253e833b70a294.chunk.js:4823)
    at createCardElement (401352253e833b70a294.chunk.js:4823)
    at HTMLElement.createCardElement (401352253e833b70a294.chunk.js:5614)
    at config.cards.forEach (401352253e833b70a294.chunk.js:5693)
    at Array.forEach (<anonymous>)

I know that the error associates itself with card-tools but i think it just may be returning zero results from the filter in auto-entries. thus... opening the issue on this repo and not on card-tools.

Thanks for your help! love all the work you've put into lovelace.

btw here is my lovelace card:

type: 'custom:auto-entities'
card:
  type: media-control
filter:
  include:
    - domain: media_player
@thomasloven
Copy link
Owner

thomasloven commented Mar 8, 2019

Auto-entities works by populating the entities: field of the supplied card.
Media-control doesn't have an entities: field, but rather an entity: field, so it won't work.

Auto-entities can't be used to create several cards at this point.

@pironic
Copy link
Author

pironic commented Mar 8, 2019 via email

@auredor
Copy link

auredor commented Aug 13, 2019

It would be good to support it somehow ;-)

@thomasloven
Copy link
Owner

thomasloven commented Aug 13, 2019

Auto-entities can't be used to create several cards at this point.

@jes1417
Copy link

jes1417 commented Jan 10, 2020

Thanks for this card I was really hoping this would help with my Plex on Xbox, it keys creating new players and I was hoping I could use this card to just display any player it so happens to use.

@k1rd3rf
Copy link

k1rd3rf commented Apr 30, 2020

I have managed to make a workaround for this by using entities as type on the wrapper card and by adding a type as option (which will be appended on the card config for each entity):

type: custom:auto-entities
card:
  type: entities
  title: Media
  show_header_toggle: false
filter:
  include:
    - entity_id: "media_player.*"
      options:
        type: custom:mini-media-player
        artwork: cover
  exlude:
    - state: "unavailable"

See https://www.home-assistant.io/lovelace/entities/#options-for-entities

@thomasloven
Copy link
Owner

Or see the bottom here: https://github.com/thomasloven/lovelace-layout-card#a-few-tips

@Tiwing1
Copy link

Tiwing1 commented Jun 15, 2022

A year+ later, but wanted to share a slightly different take on this - thanks to all the above for your previous posts! I've implemented like this, which only shows the cards that are playing or paused: (apparently I suck at formatting. sorry cant figure out how to put a code block. just puts it all inline.)

type: custom:auto-entities card: type: entities show_header_toggle: false filter: include: - state: playing options: type: custom:mini-media-player artwork: cover - state: paused options: type: custom:mini-media-player artwork: cover show_empty: false

@natethelen
Copy link

I think this is how you had it formatted:

type: custom:auto-entities
card:
  type: entities
  show_header_toggle: false
filter:
  include:
    - state: playing
      options:
        type: custom:mini-media-player
        artwork: cover
    - state: paused
      options:
        type: custom:mini-media-player
        artwork: cover
show_empty: false

BTW, you can use markdown to format the code and even specify that it is yaml for proper colorization. Start it with this and then end it with 3 more backticks:
```yaml

@natethelen
Copy link

In case others come across this post and my config could help them...

I have a (likely relatively unique) setup where I have a bunch of Sonos Ports plugged into a matrix audio switcher that drives a bunch of rooms. Nowadays you would just have 1 Port per room, but in my case the Sonos-es came later and the # of Ports would be cost prohibitive.

I wanted a dynamic UI that would show just the rooms currently sourced to each Sonos so here is what I have per Sonos:

type: entities
entities:
  - type: custom:mini-media-player
    entity: media_player.main_floor
    group: true
    info: short
    hide:
      volume: true
      power: true
      source: true
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: media_player.*_speakers
          attributes:
            source: Main Floor Sonos
          options:
            type: custom:mini-media-player
            group: true
            toggle_power: false
            hide:
              controls: true
      sort:
        method: name
    show_empty: false
    unique: true

Then I have this to list out all the rooms that are not associated to a Sonos so I can easily assign them:

type: custom:auto-entities
card:
  type: entities
  title: Unassigned Speakers
filter:
  include:
    - entity_id: media_player.*_speakers
      state: 'off'
      options:
        type: custom:mini-media-player
        group: true
        toggle_power: false
        hide:
          controls: true
      sort:
        method: name
show_empty: false
unique: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants