Lovelace: Mini Media Player

A new one: To take advantage of the now highlighted buttons via the new attribute feature, I have converted all my shortcut buttons (via source/sound_mode/channel changes) to trigger automations on changes rather than calling scripts.

In the case of Denon receivers, when a source is selected, it turns on automatically.

However, the DirecTV satellite TV device does not. That means, selecting a channel does not work unless the device is already turned on.

Likely there are other devices with this characteristic, although I cannot provide a specific example.

Sooo, here is a request: would you consider adding an option to shortcuts that would cause the device to be turned on before calling the shortcut (if not already on). From mucking around with this, if the device is turned on, a delay may be required between power on and (in this case) setting the channel.

For example:

  shortcuts:
    power_on_first: true
    power_on_delay: <seconds>

As always, thank you for considering this.

Yeah, I have a pioneer receiver that requires power on before changing source.
Using the following script to solve this atm.

media_source:
  alias: Set media source
  sequence:
    - service: media_player.turn_on
      data_template:
        entity_id: "media_player.{{ entity }}"
    - delay: '00:00:01'
    - service: media_player.select_source
      data_template:
        entity_id: "media_player.{{ entity }}"
        source: "{{ source }}"

As stated before, trying to keep the shortcuts simple, but could probably add this.
Maybe combine them into one option power_on_first: 'HH:mm:ss' similar to the current delay option in scripts.

New release v1.1.2

ADDED

  • Sound mode select, similar to source select (only for devices with support for sound_mode)
  • Optional progress/runtime indicators
  • New min_volume option (#116)
  • New sound_mode option, to change the appearance of sound select
  • New sound_mode option in hide option object, to set visibility of the sound_menu, hidden by default
  • New runtime option in hide option object, to set visibility of the runtime indicators, hidden by default

FIXED

  • Fixed background not displaying (#115)
  • Fixed alignment and button spacing of power button & media controls when (icon, name & info) are all hidden

hyperion_8123_lovelace_4
hyperion_8123_lovelace_4 (1)

1 Like

Karl,

Re: power_on_first

syntax is obviously fine. I was doing the same kind of thing using scripts, but no active button in that case.

Sleeping on this, another perhaps more flexible approach would be to have a script that gets called whenever a button is pushed. For example, if TV channel 11 button is pushed, receiver and TV gets turned on as well. I currently do this by having an automation that triggers on setting the channel (which does not work for my DirecTV device unless it is already on as noted before).

what’s your DirecTV target model number?

i could shoot you over a custom component that, before sending any remote commands, would check if the device was powered on, and if it was on standby, send a power on command and sleep for like
5 seconds first. quite honestly, that’s how it should have been designed first if you’re trying to shoot commands to the DVR, assuming it’s not one of the new clients, because we’re kinda fucked there unless you have something like a harmony to out of band it.

I have a DirecTV HR44/200 for the main DVR, and two clients (that do not support IP power on/off).

For the power neutered clients, I do have iTach IP2IR, Harmony Hub and Broadlink; been thinking about exploring the universal remote to merge IR power on/off with the IP based primary DirecTV addon.

Trying to get rid of all IR stuff


roger.

i got an HS17 next to my rack and C61-K’s all over the place. let’s pause for a minute and give DirecTV a round of applause for the infinite wisdom for being able to do literally everything else over coax between server and clients except power. Truly Genieeeeus. (eh?)

yeah. in your use case, i’d probably check for status of target receiver first, maybe via automation, and then blast some IR love via your harmony/iTach with a sleep somewhere in there.

i wrote the devs asking for a id/secret for the authenticated SHEF commands. i’m not holding my breath. with the ATT acquisition, i imagine it’s probably a ghost town over there.

I do share your sentiments re DirecTV power on/off


The client still reports “playing” status when turned off with the OEM remote; but there are enough other attributes that power status determination can be automated. I’d like to give your custom component a try (this is not something Karl can fix). Do you have the IR codes as well?

1 Like

I cannot get this card to work. I use Home Assistant inside a docker container. The mini-media-player-bundle.js file is placed inside the container in /config.

My ui-lovelace.yaml:

title: HomeAssistant
resources:
  - url: /config/mini-media-player-bundle.js?v=1.1.2
    type: module
views:
  - badges:
      - sensor. ...
      - ...
    cards:
      - type: custom:mini-media-player
        entity: media_player.sonos
        icon: mdi:spotify
        artwork: cover
        hide:
          source: true
          power_state: false
      - entities:
          - ...

I get the infamous

Custom element doesn't exist: mini-media-player.

{
  "type": "custom:mini-media-player",
  "entity": "media_player.sonos",
  "icon": "mdi:spotify",
  "artwork": "cover",
  "hide": {
    "source": true,
    "power_state": false
  }
}

My first question: Did I place the code snippets at the correct position? (Suggestion: A minimal working example of a configuration in the GitHub repo for troubleshooting would be great.)

Hey!
You need to place the file inside [your config directory]/www/. So for example config/www/. If there’s no www folder there already, you’ll have to create one and restart HA after doing so.
Then the resource url in your ui-lovelace.yaml has to point to /local/ which is where the www directory is served at by the webserver.

That did it! Thanks a lot!

i’m having trouble setting up this card. i have .js file inside www

raw config:

configuration.yaml
image

error i’m getting:

I have this card running really good.

In my resources: list I use -type: js and I do not have anything after the .js suffix.

Your configuration.yaml looks like mine.

1 Like

Very strange, everything looks alright, I’ve actually never really used the UI editor, but maybe try by removing the dash (-) before type.

2 Likes

thanks removing (-) worked
 so tts does not support on google home mini ?

My mini’s work fine

Yes, tts should work fine on Google Home.

Hi,
Question 1) I specified the option volume_stateless=true, what I miss on this view is the actual volume level info (not as a bar but as value, better would be %).
Question 2) Is it possible to specify the steps of increment/decrement when pressing the +/- volume ?

The reason:
I usually use the volume on the range of 2% to 20% and on this area it it not so easy with the mobile phone to adapt the volume (this is why I like the + / - buttons), but I would like to see what is the actual volume.

will mini_media_player work with the upcoming sonos breaking changes in HA 0.93.0?

Is it possible somehow to set a fixed picture as background in the player?
I have a TV that doesn’t send information about the content, and I therefore it would be nice to have an image instead?
If it’s possible - how, and would it also be possible to use a fixed picture background when the state of the media player is idle? :grimacing: