Lovelace: Mini Media Player

I managed to solve … as I am using the new editing interface I had to put the resources in it … see how it was !!

Sorry for the inconvenience … but the tips for the next ones are …

resources:
  - url: /local/mini-media-player-bundle.js?v=1.0.2
    type: module
  - url: /local/my-custom-card.js
  - url: /local/custom_ui/weather-card.js
    type: js
  - url: /local/my-webfont.css
    type: css
  - url: /local/button-card.js
    type: module
    resources: null
  - url: /customcards/github/thomasloven/card-tools.js?track=true
    type: js
title: Home Assistant
views:
  - badges:
      - binary_sensor.tv_sala
      - binary_sensor.mi_box
      - binary_sensor.ki_plus
      - device_tracker.renato_iphone
      - device_tracker.juliana_iphone
      - sensor.temp_message
      - sensor.sonoff01_double_hold
      - sensor.dark_sky_temperature
      - sensor.campainha
      - sensor.disk_use_percent_home
      - sensor.iphone_de_renato_battery_state
      - sensor.iphone_de_renato_battery_level
      - sun.sun
    cards:
      - entities:
1 Like

I had a similar error, the card wouldn’t show till I put the resources line near the very top of the lovelace-ui. Now all good!

I was wrong. It must be the first line in the raw editor. Then it works fine, Thanks to all.

I read that this card is not working good with the latest alexa_media custom component. Is it right? And if yes, how to fix it? I have problems with tts alexa platform as it always doesn’t work telling me it cannot use tts google platform.

Where did you read that?

You would have to specify platform: alexa in order for tts to work with the custom “alexa/echo component”.

- type: custom:mini-media-player
  entity: media_player.echo
  tts:
    platform: alexa

https://github.com/kalkih/mini-media-player/pull/37

I read it here:

About the platform i have alexa already set for my echo devices, but always get ‘failed a call to media_player/alexa_tts service’ or something similar…

They are using invalid configurations.

Ogh, you said “telling me it cannot use tts google platform.” before, that’s why I thought you had an incorrect card config.

Not sure, doesn’t look like anything has changed from reading the docs.
I don’t see why it wouldn’t work, and I can’t test it since I don’t have any echos.

Ok, so i hope someone else having an echo can test it and help me to solve this issue…

Posted in the custom alexa component thread, and seems like at least this guy/gal got it to work.

Found it !!!
I added to the code:

language: 'it'

If i disable it all is working !!

1 Like

Can you post your config for the card (using the format button </> )?

My experience with mini-media-player is this.
I have this configuration withe latest version also of Alexa Media player

      - type: custom:mini-media-player
        entity: media_player.echo
        tts:
          platform: alexa
        group: true
        icon: 'mdi:amazon-alexa'
        icon_state: true
        hide:
          controls: true

      - type: custom:mini-media-player
        entity: media_player.mini
        tts:
          platform: google
          language: it       #not necessary 
        group: true
        icon: 'mdi:google-home'
        icon_state: true
        hide:
          controls: true

and it works.

language: it works only with Google TTS, but it’s not necessary. I get same language, italian, also if there isn’t this row.

One main difference is that with Alexa media player the volume slider is alway active and the Power ON/OFF button does nothing, while with Google media player, the volume slider is available only if I turn on the device with the Power ON/OFF button.

I don’t think Alexa as media player entities ever turn off, they instead go standby.
You can use the idle view feature to kinda simulate on/off. There are a few options available for the idle_view object, but I think when_standby should work with Alexa as media player, check the card docs for other available options.

idle_view:
  when_standby: true

You could I guess also hide the power button if you want as there’s no on/off for the alexa component

From the source

    def turn_off(self):
        """Turn the client off.
        While Alexa's do not have on/off capability, we can use this as another
        trigger to do updates. For turning off, we can clear media_details.
        """
        ...

    def turn_on(self):
        """Turn the client on.
        While Alexa's do not have on/off capability, we can use this as another
        trigger to do updates.
        """
        ...

I’m having an unusual issue with the media player card - added it to my configuration yesterday and to begin with it was working fine, however today instead of seeing the cards I’m just seeing a bit of text that either says ‘off none’ ‘idle none’ or ‘playing none’ depending on the state of the player.

When I click on the text it writes to the log:

https://xxxxxxxxx.duckdns.org/local/mini-media-player-bundle.js:1:36259 TypeError: this.value.handleEvent is not a function. (In 'this.value.handleEvent(e)', 'this.value.handleEvent' is undefined)

My lovelace yaml seems pretty normal:

resources:
  - url: /local/mini-media-player-bundle.js
    type: js

…and where configured:

  • type: custom:mini-media-player
    entity: media_player.tv
    artwork: cover

NB I promise indentation is all correct - I’m sending this from a work computer where proper formatting doesn’t want to work for some reason

The only change I’ve made is a global font change but I can’t see any reason why that would have scuppered things - I’ll try changing back to the previous font and see if it fixes it and report back

BTW media players are all google cast devices

I’d like to use the tts feature in my media player card.
This is my config and it works fine like this.

As I don’t need the tts feature everyday it would be nice to only see it when I click on the player. Is that possible?

the correct way is

resources:
  - url: /local/mini-media-player-bundle.js
    type: js

Sorry - again, at work PC, not able to copy and paste from configurator. Your correction is what I already have in yaml. Post edited to reflect this

EDIT: Haven’t got around to changing fonts yet, but tried adding ?v=0.01 to my url in the lovelace yaml - it briefly worked properly again, then I refreshed the home assistant app on iphone and lost it again. Odd

Yes, skip the cards tts and use the tts input in the default more info popup, which you get to by clicking/pressing on the entity.

That’s strange, try replacing type: js with type: module, this is obviously not a viable solution if you are dealing with older devices.

1 Like

When I press the entitiy the pop up window doen’t include a tts field.
No matter if a press the entity, the default card or your lovelace card.

I guess the player has to support TTS.

32

Otherwise, you could use popup-card and create your own popup.