Lovelace: Mini Media Player

Should be this I think

    turn_on:
      service: switch.turn_on
      target:
        entity_id: switch.0xa4c138db8ae96f3f
    

Same for turn off.

2 Likes

Unfortunately, I keep getting the message

The media_player/turn_off service failed to invoke. Entity media_player.volumio does not support this service.

Where do you see this?

When I press the power button on the player

You are still using the volumio media player. You need to use the one created by the universal media player.

It’s getting better :slight_smile: But only the first switch after restarting the settings works

Don’t know if this question is asked before in this topic so sorry if it is.

Is it possible to create 2 dropdown lists in the mini media player? So 1 list for spotify playlists and 1 list for radio stations.

Thanks!

1 Like

Why not use stack-in cards and build your own? In this screen shot in yellow there are four cards:

You need to think “out-of-the-box” and not inside. I created that because Mushroom has no input_select for inputs … so I jam an input_select and a media_player in a row … then I want dancing icons … so fracture that off … and I want to control level with my finger.

Four cards … so be it. No changes required by developers.
And then implement decluttering card … and bam.
Those are all auto-entities for every zone in my Dayton Audio matrix, with one simple decluttering template

1 Like

Hello all.

I wanted to create a dynamic background so I went for the code below unfortunately this didn’t work.
Is there another way to dynamically display background images?

background: >-
   {% if (state_attr('media_player.kantoor_audio', 'media_content_id') | contains('538')) %}
        https://www.mp3streams.nl/logo/z/radio-538 
   {% else %}
         'https://www.mp3streams.nl/logo/z/qmusic'
   {% endif %}

Your first image isn’t quoted, the second is.

I’ts not the quotes.With or without the quotes the outcome is the same.
It’s like the URL is not picked up in the if statement. Using the code in developer tools → templates it works fine and show the right URL.
That is why I thought this would work.

UPDATE
I just tried this and also this doesn’t give any results.

background: '{% if (1==1) %}https://www.mp3streams.nl/logo/z/radio-538{% endif %}'

I believe it is not possible to use statements in the background.

UPDATE 2:
I solved it with card-mod.

.mmp__bg {                              
                              {% if (state_attr('media_player.kantoor_audio', 'media_content_id') | contains('538')) %}
                                  background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/ec/Logo_538_Nederland.png') !important;
                              {% elif (state_attr('media_player.kantoor_audio', 'media_content_id') | contains('qmusic')) %}
                                background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Qmusic_logo.svg/1714px-Qmusic_logo.svg.png') !important;
                              {% elif (state_attr('media_player.kantoor_audio', 'media_content_id') | contains('3fm')) %}
                                background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/NPO_3FM_logo_2020.svg/640px-NPO_3FM_logo_2020.svg.png') !important;
                              {% elif (state_attr('media_player.kantoor_audio', 'media_content_id') | contains('SKYRADIO')) %}
                                background-image: url('https://upload.wikimedia.org/wikipedia/commons/4/4e/Sky_Radio_logo_2019.png') !important;
                              {% elif (state_attr('media_player.kantoor_audio', 'media_content_id') | contains('RADIO10')) %}
                                background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Radio_10_logo_2019.svg/2560px-Radio_10_logo_2019.svg.png') !important;
                              {% endif %}
                              background-repeat: no-repeat !important;
                              background-origin: padding-box !important;
                              background-size: contain !important;
                              background-blend-mode: multiply;
                              opacity: 0.3 !important;
                            }
2 Likes

I know that I am reacting to the post almost one year old :thinking: Did you solve the animated icon? I have animated bars and static as well and would like to achieve animated icon while playing and static while not.

No, but I wasn’t looking for it.

OK. Thanks anyhow.

Hi there,

I am trying to make the tts function working, but i cant figure it out…
i’ve created a script and in developer tools, it is working. I would love to combine this in the mediaplayer, so i can use it there. can someone help me with this?

the script that is working in developtools is:

service: script.turn_on
target:
  entity_id: script.google_home_resume
data:
  variables:
    action:
      - alias: Send TTS message
        service: tts.google_translate_say
        target:
          entity_id: media_player.junior
        data:
          message: "{{states('input_text.tts')}}"    
        extra:
          volume: 0.8

notice the template for the state of an input text helper. What i would like even more, is just a txt field where i can type the message to TTS to the mediaplayer.

can someone help me with this? Or is it just not possible? Maybe another workaround then?
Thanks in advance for your help!! i am a noob in home assistant and templating, but am trying and experimenting… If you want i can share the code from my mediaplayer card also…

Nothing to do with this thread.

Sorry if i was not so clear with the info i gave.

I am using the mini media player as a media player in my home assistant for different google hubs and mini’s. I’ve created with the mini media player a mediaplayer with different radio station buttons, and also a dropdown list with different spotify playlists. i’ ve also added the tts option in the media player and it worked for a while. Since last home assistant update the tts is not working anymore. So i am trying to set this up again.

The script described above, is just a script that i would like to implement into the media player TTS function but i can not figure it out.

Forgive me if i am in the wrong topic for this, i thougt this was a topic about all the questions that had to do with the mini media player options and config possibility’s.

If not, please tell me and i will delete this post.

my code for the mini media player i am using and that was working perfect is as followed:

card:
  type: custom:mini-media-player
  entity: media_player.junior
  artwork: cover
  source: full
  sound_mode: full
  info: short
  background: /local/radio/radio5.png
  shortcuts:
    columns: 3
    label: Playlists...
    buttons:
      - type: service
        id: media_player.play_media
        cover: /local/radio/JoeFm.png
        data:
          media_content_type: music
          media_content_id: media-source://radio_browser/3b06322e-cbae-4e67-88f2-c5ade8306b63
          enqueue: replace
          entity_id: media_player.junior
      - type: service
        id: media_player.play_media
        cover: /local/radio/Qmusic.png
        data:
          media_content_type: music
          media_content_id: media-source://radio_browser/00dc2e9a-578c-430b-bdc2-244b71444dfc
          enqueue: replace
          entity_id: media_player.junior
      - type: service
        id: media_player.play_media
        cover: /local/radio/Mnm.jpg
        data:
          media_content_type: music
          media_content_id: media-source://radio_browser/961957e7-0601-11e8-ae97-52543be04c81
          enqueue: replace
          entity_id: media_player.junior
      - type: service
        id: media_player.play_media
        cover: /local/radio/Joefm80s90s.jpg
        data:
          media_content_type: music
          media_content_id: media-source://radio_browser/cdf1baaf-ed22-41c5-8c9e-90b4133fda8f
          enqueue: replace
          entity_id: media_player.junior
      - type: service
        id: media_player.play_media
        cover: /local/radio/Qfouteradio.jpg
        data:
          media_content_type: music
          media_content_id: media-source://radio_browser/1b7d90db-1645-47a2-99fb-4810efbf4ff0
          enqueue: replace
          entity_id: media_player.junior
      - type: service
        id: media_player.play_media
        cover: /local/radio/nostalgie.png
        data:
          media_content_type: music
          media_content_id: media-source://radio_browser/ace588cd-ad88-4ae8-b050-ef1bfc8a0a0e
          enqueue: replace
          entity_id: media_player.junior
    list:
      - name: Vinzmuziek
        type: service
        id: spotcast.start
        data:
          entity_id: media_player.junior
          uri: spotify:playlist:3YOR6C9vPtRuLIn86xCTCS
          random_song: true
          shuffle: true
      - name: Summer
        type: service
        id: spotcast.start
        data:
          entity_id: media_player.junior
          uri: spotify:playlist:6fHe8m2DDk5bN6cDb6Mbec
          random_song: true
          shuffle: true
      - name: Jaap Reesema
        type: service
        id: spotcast.start
        data:
          entity_id: media_player.junior
          uri: spotify:playlist:2egZ1H8XjV9ei9z4eQ51ZS
          random_song: true
          shuffle: true
  name: Junior
  icon: mdi:radio
  group: false
  volume_stateless: false
  toggle_power: false
  tts:
    platform: cloud

Hi, I have a Denon receiver and it works great with this mini media player except one thing, despite the HEOS integration provides these 3 attributes, it doesn’t provide seek service, and it seems this could be the problem as I can’t make it to display the progress indicator at the bottom of the card.
Is it possible to show the progress indicator without the seek service, as I don’t need it but would like to see the progress?
The card displays the length and the remaining time however.

I solved this to do this,
Card indeed lost his text input after the update.

step1:
HACS install:

Dont forget to ad the source:

/hacsfiles/lovelace-multiline-text-input-card/lovelace-multiline-text-input-card.js   

Restart Hassio, then make a helper:

  tts_message:
    name: TTS Message
    initial: "This is a default message"

Then make automation:

automation:
  - alias: Trigger TTS Service
    trigger:
      - platform: state
        entity_id: input_text.tts_message
    action:
      service: tts.google_say
      data_template:
        entity_id: media_player.google_nest_woonkamer
        message: "{{ states('input_text.tts_message') }}"

Then ad the follow text-card on your Dashboard:

type: custom:lovelace-multiline-text-input-card
entity: input_text.tts_message
name: TTS Message

Then you need to change the media-card:

type: custom:mini-media-player
entity: media_player.google_nest_woonkamer
artwork: cover
source: icon
sound_mode: full
tts:
  platform: google
  message: '{{ states(''input_text.tts_message'') }}'
icon: phu:google-home

Enter the text you want your smart speaker to say into the new input card. When you click the ‘Save’ button, the text you’ve entered will be sent to your speaker through an automation, allowing it to speak the message aloud.

image

Greets

Mupsje

Thank you very much!

Will try this.

A couple of days ago it worked with the media player code i provided above. Then i had a txt field at the bottom in the mediaplayer, where i could just type the message, and then next to it stood: send. and when i clicked on send, the message that i wrote was send to the speaker…

But somehow that doesn’t work anymore… maybe with the update? i dont know.

Do you think it would be possible using the script that i wrote above the media player code, implemented into the mediaplayer?

Why i ask this is: with that script, i am able when playing radio station or spotify stream, to send tts to the speaker, and when the tts message was spoken, the radio station or spotify stream, resumed playing from the point where it was… And that would be very nice…

thanks for your help! I will have a look at it!!