Lovelace: Mini Media Player

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!!

If you’ve lost the text-input field (due to ‘paper-input’ having been deprecated), until there is an update released (has the project been abandoned?..it looks like some time since there were last any updates) you can faily simply make the necessary changes yourself to the mini-media-player-bundle.js in ‘config\www\community\mini-media-player’ (and compress this with gzip compression format to create a new mini-media-player-bundle.js.gz, replacing the old one):

Open mini-media-player-bundle.js and change every entry of ‘paper-input’ with ‘ha-textfield’

Once you’ve made and saved the changes, you will need to reload your frontend cache:

This is simple in a browser, just follow your usual broswer cache reset procedure.

For the iOS app, it’s a bit different: Side bar → Settings → Companion App → Debugging → Reset frontend cache (you may need to do a ‘swipe-down’ to reload the page from the Home Aisstant lovelac screen).

In android, again a bit different: go to your android OS settings (the system settings, not in the HA app) → Apps storage → Home Assistant → Clear Cache.

Hope this helps anyone with similar issues!

4 Likes

Thank you very much for this solution!! It worked!!

Do you think there is a possibility for me to implement the script from my previous post, into the media player, so that i can type the message in the txt field, and when click on the Send button, that it loads a script that i created and where the txt in the txt field is used in my script to send to the mediaplayer?

Anyhow, very very much appreciated that you came up with a solution for the missing txt field!!

Thx!!

@frenck
@balloob

Sorry to ping you out of the blue like this.

I don’t know if you’re aware of this add-on, but it represents a huge upgrade from the stock HA Media card.

The developer seems to be away from the project, so maybe there’s a chance to either bring him into the fold and make this a native HA card, or come to some kind of agreement to use his work as a base for a new media card?

I edited the .js file. Why is recompressing necessary? This did not work even after re-compressing.

UPDATE:
After following the above steps 3 times from start to finish it finally worked. Not sure why it took so much hoop-jumping. Thanks for the band-aid info. Hopefully someone picks this up to maintain and fixes it permanently.

Just a head’s up to everyone.

@kalkih, the developer for this add-on, has put up an issue in the github repo asking for maintainers to help in the future.

I personally don’t have the know how to do much more than testing and providing feedback going forward, so I’m posting here to spread the word.

This is what it looks like vs the native, the progress indicator is not shown but track length and remaining is there.

Link 🚨 Looking for maintainer(s)! · Issue #789 · kalkih/mini-media-player · GitHub

1 Like

It is related to this issue, am I right? Then it should be resolved soon… :crossed_fingers:

In my player the paper slider pin only works in expanded view. Previously it also worked in collapsed view. Where to look for the cause?

When was “previously”? Did you you change (add/upgrade) anything?

It doesn’t even work in the new basic tab

type: custom:mini-media-player
entity: media_player.universal

Here is the current configuration of my player

type: custom:mini-media-player
entity: media_player.universal
group: false
icon: mdi:radio
volume_stateless: false
toggle_power: false
hide:
  name: true
  source: true
  power_state: false
shortcuts:
  columns: 4
  buttons:
    - image: /local/images/RMF.png
      type: source
      id: RMF
    - image: /local/images/eska.png
      type: source
      id: ESKA
    - image: /local/images/1fm.png
      type: source
      id: 1.Fm
    - image: /local/images/supernova.png
      type: source
      id: supernova

Be more specific. What does that statement mean? Doesn’t it render? Can’t you control it?

Why aren’t you answering these questions?

Paper slider pin only works in expanded view.
mini3

Recently I only added the turn on/turn off commands in the universal player in configuration.yaml.

media_player:
  platform: universal
  name: universal
  children:
    - media_player.volumio
  commands:
    turn_on:
      service: switch.turn_on
      target:
        entity_id: switch.radio
    turn_off:
      service: switch.turn_off
      target:
        entity_id: switch.radio
  attributes:
    state: switch.radio

You can work with boolean_switches that are handed over to HomeKit.

Step 1: create a boolean_switch in HA for each radio station
Step 2: make the boolea_switch accessible via HomeKit
Step 3: create an Automation in HomeKit that plays the radio station on the HomePod, when the switch for the radio station is turned on
Step 4: create an Automation in HA that turns off the boolean after maybe 2 seconds after it was turned on

Then every time you activate the boolean switch in Home Assistant, the radio station gets played on your HomePod.

Hello,

first of all, its a really great project, I love it, but I cant get it to work with my echo devices.
Thats what it sais using it with youtube music player to play my playlists.
“To send tts set announce = true. Music can’t played this way.”
Do you have any ideas?

Thanks