Nerwyn / android-tv-card

A completely customizable universal remote card for Home Assistant. Supports multiple platforms out of the box.
Apache License 2.0
254 stars 13 forks source link

volume buttons doesn't work and image of button not showing #56

Closed 1mfaasj closed 9 months ago

1mfaasj commented 10 months ago

Hi! is there something changed in the setup? Because I can't control the volume anymore, it doesn't react anymore when I click on one of the volume buttons. Also the image of "nlziet" is not showing anymore. Weird because the image is still there when I open the URL and it worked before. I've looked into the docs (frontend of your repo) and "card_mod" is not there. Is this recently changed? And maybe the reason it doesn't work? image

My setup:

type: custom:android-tv-card
remote_id: remote.chromecastwoonkamer
media_player_id: media_player.samsung_au7100_70_tv
keyboard_id: media_player.android_tv_192_168_2_32
title: Chromecast
rows:
  - - back
    - power
    - home
    - search
  - - volume_down
    - volume_mute
    - volume_up
  - - navigation_buttons
  - - netflix
    - youtube
    - disney
    - spotify
    - videoland
    - nlziet
  - - previous
    - rewind
    - play_pause
    - fast_forward
    - next
custom_sources:
  videoland:
    source: videoland-v2://
  nlziet:
    source: nlziet://
card_mod:
  style: |
    ha-icon-button[title="videoland"] {
      background-image: url(https://cdn6.aptoide.com/imgs/3/c/8/3c8d26f1af6306c09b9cfa24fe679949_icon.png);
      background-repeat: no-repeat;
      background-size: contain;
    }
    ha-icon-button[title="nlziet"] {
      background-image: url(https://seeklogo.com/images/N/nlziet-logo-6FB1C30F53-seeklogo.com.png);
      background-repeat: no-repeat;
      background-size: contain;
    }
custom_keys:
  volume_down:
    service: media_player.volume_down
    service_data:
      entity_id: media_player.samsung_au7100_70_tv
  volume_mute:
    service: media_player.volume_mute
    service_data:
      entity_id: media_player.samsung_au7100_70_tv
      is_volume_muted: true
  volume_up:
    service: media_player.volume_up
    service_data:
      entity_id: media_player.samsung_au7100_70_tv
Nerwyn commented 10 months ago

What version were you on before this? card mod broke a while ago. You have to either account for the shadow roots within card mod or use the built in style options. You must be upgrading from a much older version.

While your config should continue to work otherwise, here it is upgraded to the latest version's syntax:

type: custom:android-tv-card
remote_id: remote.chromecastwoonkame
slider_id: media_player.samsung_au7100_70_tv
keyboard_id: media_player.android_tv_192_168_2_32
title: Chromecast
rows:
  - - back
    - power
    - home
    - search
  - - volume_down
    - volume_mute
    - volume_up
  - - navigation_buttons
  - - netflix
    - youtube
    - disney
    - spotify
    - videoland
    - nlziet
  - - previous
    - rewind
    - play_pause
    - fast_forward
    - next
custom_actions:
  nlziet:
    tap_action:
      action: source
      source: nlziet://
    style:
      background-image: url(https://seeklogo.com/images/N/nlziet-logo-6FB1C30F53-seeklogo.com.png);
      background-repeat: no-repeat;
      background-size: contain;
      background-position-y: center;
custom_actions:
  volume_down:
    tap_action:
      action: call-service
      service: media_player.volume_down
      data:
        entity_id: media_player.samsung_au7100_70_tv
  volume_mute:
    tap_action:
      action: call-service
      service: media_player.volume_mute
      data:
        entity_id: media_player.samsung_au7100_70_tv
        is_volume_muted: true
  volume_up:
    tap_action:
      action: call-service
      service: media_player.volume_up
      data:
        entity_id: media_player.samsung_au7100_70_tv

The volume buttons on this config work fine for me, so that might be a caching issue. Can you try to clear the app/browser cache and try again?

1mfaasj commented 10 months ago

I already thought it was changed, thanks for the confirmation and new solution! I will test the volume in the upcoming days. One question though: I've got multiple HA integrations, which one do I need to define in the yaml in order to use Android tv card and control the volume? I've got for instance: Android TV Remote, Android Debug Bridge , DLNA Digital Media Renderer, Samsung Smart TV and Google Cast integrations installed and belonging entities which are all pointing to the same smart TV ...

The button however appeared again 👍

Nerwyn commented 10 months ago

You need the Android TV Remote integration to use this card without overwriting the default keys. The Android Debug Bridge integration is used for the keyboard. If you want to use the slider for volume instead, you need to assign the media_player entity ID created by the Android TV Remote integration to slider_id (formerly media_player_id).

1mfaasj commented 9 months ago

thanks for the clarification. looks like it's solved. one of the tv's keeps asking me for authentication, very annoying but that could be the reason why it's not reacting properly.