usernein / tv-card

📺 TV Remote Card (with touchpad and haptic feedback)
Apache License 2.0
107 stars 26 forks source link

Volume buttons #7

Closed 1iverea9er closed 2 years ago

1iverea9er commented 2 years ago

How to configure the execution of castom service for each button (volume_up, volume_down, volume_mute) ??? Вefault service does not work.

p.s. and same problem for 'navigation_row'

usernein commented 2 years ago

@1iverea9er it's documented on Custom buttons

1iverea9er commented 2 years ago

I really don't understand how to do this. I tried the following code in card section ...

          volume_row:
              - vlm_down
              - mute
              - vlm_up

....

and following code in 'custom_keys' : ....

              vlm_down:
                icon: mdi:volume-minus
                service: media_player.volume_down
                target:
                  entity_id: media_player.sony_bravia_tv
              mute:
                icon: mdi:volume-mute
                service: media_player.volume_mute
                target:
                  entity_id: media_player.sony_bravia_tv
              vlm_up:
                icon: mdi:volume-plus
                service: media_player.volume_up
                target:
                  entity_id: media_player.sony_bravia_tv

....

image

What am I doing wrong ?

rafalpetryka commented 2 years ago

@1iverea9er you should try volume_row: buttons and custom keys like this

volume_down:
  icon: mdi:volume-minus
  service: media_player.volume_down
  target:
    entity_id: media_player.sony_bravia_tv
volume_mute:
  icon: mdi:volume-mute
  service: media_player.volume_mute
  target:
    entity_id: media_player.sony_bravia_tv
volume_up:
  icon: mdi:volume-plus
  service: media_player.volume_up
  target:
    entity_id: media_player.sony_bravia_tv

Then it should works fine ;)

1iverea9er commented 2 years ago

rafalpetryka Oh, thanks, I seem to have tried this option as well. However, I did not take into account that the home assistant services template gives a slightly different code for calling the service:

service: media_player.volume_down data: {} target: entity_id: media_player.sony_bravia_tv

It is used here:

icon: mdi:volume-minus service: media_player.volume_down service_data: entity_id: media_player.sony_bravia_tv

target: mast be replaced as service_data:

usernein commented 2 years ago

Nah, data is is service_data and target doesn't exist