Media Player Volume + - only not full media player entity

Hi All

I just want to show individual buttons for my amplifiers for volume up and down (2 buttons) / power on off (one button). They are classed as media_player in HA but just want to use the + - and power on off options rather than have the full card

thanks

you could create an input slider and an automation that sets the volume based on the slider and then add the slider to the dashboard.
same for power, create an input boolean or template switch for that.

@ReneTode and @frank451 Or we could try the javascript widget again :slight_smile:

media1:
  widget_type: javascript
  entity: media_player.my_media_player
  title: "Media"
  icon_on: mdi-television
  icon_off: mdi-television
  command:  "args = {}; args['service'] = 'media_player/media_play_pause'; args['entity_id'] = self.parameters.entity; self.call_service(self, args);"

This widget will toggle the play/pause for your media player. You should be able to figure out how to adjust the volume from this also by using the services media_player/volume_up and media_player/volume_down instead of media_play_pause. Use media_player/toggle as service to switch on/off. For the volume though, I think an input slider as per Reneā€™s suggestions would be more handy to control.

1 Like

One thing that comes to mind here is to write a general service widget that could call any service for any entity.

using the build in functions at the command line. wow never thought of that.
i guess the dashboard is already more flexible then i did think off.
thanks for pointing that out to me.

and indeed service call widget was already on my list from things that are needed.
but pointing this out to me makes me think that it only needs a yaml file.

Thanks for the input and suggestions.
The slider is the best idea, however on of my older Sony amps using the broadlink media player (IR) so Iā€™m not sure I could use the slider for that?.. there will be no status as such being IR.

When you both mention the command line option, i donā€™t think Iā€™ve used this in the past with the dashboard, could you eloborate?

My goal is to have Plex in a iframe (which is working well, using chrome), when using Plex on chrome even via the iframe in the dashboard you can cast to devices which works well for my needs. So under the iframe I want my basic control for onkyo zones 1-3 my Sony receiver (IR only), plus a couple of older amps one a car amp switched on via relays in the loft for music in bedrooms and bathroom. So again simple enough on off for these as they will be set ambient levels Iā€™ve no need for volume.
Whole house audio I just cast to a group via Plex. Which in turn I will have a button whole house audio on/off input Boolean.
Just need it all to look simple and keep the wife happy.

Check out vxg media player too, works well in a iframe for real time rtsp streams.

Think Iā€™ve said too much :zzz::zzz:

In the javascript widget that I suggested that you could use for your switches, I made calls to internal widget functions like the call_service() function. Rene only pointed out that he hadnā€™t considered that this was possible. By using the javascript widget as a switch, you can basically implement any functionality you need.

Do you know if it works in an iframe on an iPad? I didnā€™t find any way to implement rtsp on the iPad in a widget but it would be nice if it worked.

broadlink media player?
you mean you use a broadlink to create switches? or is there a custom component?
if you have a broadlink then you normally got 2 switches for the volume up and down.
in that case you can use 2 switches on the dashboard also.

Iā€™m not sure to be honest, Iā€™m only using it on a windows machine with chrome which runs my 26ā€ touch wall panel with Hadashboard on. I assume it will do or at least on chrome for iOS.

And canā€™t try it on my mobile at the minute as itā€™s running via the mongoose web server on said machine and canā€™t acces on the normal lan due to its on local addressing.

I will have a play tomorrow and test

Yes thereā€™s a custom component available works really well.

If it was just broadlink switched, I could do what Iā€™m trying. Just donā€™t know enough about programming. The media player sub entities such as vol channel/input etc donā€™t seem to have there own sub entities, which is why Iā€™m struggling I suppose.

do you have the normal broadlink component setup in HA?
and can you show me how that mediaplayer is setup in HA, and/or a link to where the component is?

yes i use both the normal broadlink component and also the custom one see link below.

Broadlink Custom

when you use the normal broadlink component you can add switches.
in the ini file from the custom mediaplayer you have the codes.

so you can just add a switch for up and down volume to you broadlink component
then you can add momentary switches to your dashboard.

yea i sort of do that for the other IR devices, however the onkyo is controlled over IP rather than IR. The Sony AMP is controlled via the IR broadlink Media_player. I have a ESP-01 attached to the amp, which in turn the custom component pings, so i know the status of the power.

Iā€™ll have a play about, its probably more the onkyo as im using the native component, so extracting the vol up down into a button needs doing. Theres probably some sort of script/boolean i can do within HA, but need to get my head round it more.

I suppose the javascript widget is not part of the normal appdaemon package?
How do I install this in hass.io?

javascript widget is default in appdaemon
https://appdaemon.readthedocs.io/en/latest/DASHBOARD_CREATION.html#javascript

Ah Ok. great. Its working now. However independent of what I select as Icon I always get a * as icon

kitchenvup:
  widget_type: javascript
  entity: media_player.kitchen
  title: "Media"
  icon_on: mdi-radio
  icon_off: mdi-radio
  command:  "args = {}; args['service'] = 'media_player/volume_up'; args['entity_id'] = self.parameters.entity; self.call_service(self, args);"

Cosmetic Arguments

  • icon_active
  • icon_inactive
  • widget_style
  • title_style
  • title2_style
  • icon_active_style
  • icon_inactive_style

not icon_on or icon_off

1 Like

cool. thanks!