Comment contrôlez-vous votre TV Android?

Le rendu actuel :

avec une popup pour le volume :

et le détail d’un programme :

Quand je clique sur le logo d’une chaine => ça change la chaine (!)
Scrollable gauche / droite, et haut / bas
La partie grisée, c’est « avant maintenant ». :smiley:

3 « J'aime »

Salut tout le monde,
J’ai lu attentivement ce fil très riche qui m’a permis par hasard de mettre en place une télécommande pour freebox (chose que je voulais faire depuis longtemps mais qui n’était pas une priorité)

J’ai testé 2 modes pour ce faire :

  • celui avec les commandes remote en passant par exemple par le service « remote.send_command »
  • celui avec les commandes adb en passant par exemple par le service « androidtv.adb_command »

Au passage, chez moi le 1er cas est beaucoup plus réactif.

J’avais une question à vous poser concernant notamment le volume et les boutons channel (ou HAUT/BAS)

Avez-vous une solution pour faire en sorte que lorsque l’on maintient le bouton (volume + par exemple) Cela incrémente le volume pour éviter de devoir appuyer successivement ??

Y a t’il une limitation du fait des possibilités des services ou de HA ou y a t’il une astuce ? En passant par du hold_action ou un script quelconque ?

Si toutefois, c’est un souci que vous avez solutionné je suis preneur :wink:

EDIT: Question 2 au cas ou Y a t’il un moyen simple dans les logs, les outils de dev ou encore en ligne de commande de voir comment ce service (volume + par exemple) est-il effectué par le bais de la télécommande d’origine Freebox ou android ? Ce qui peut être aussi une piste pour reproduire le service ? Merci :wink:

Merci à vous par avance.

Hello,

Je tente de changer la source HDMI de ma tv TCL via HA.

Quand je fais la commande sur mon mac cela passe bien. Mais quand j’utilise cette meme commande dans HA ca ne marche pas.
QQun saurait comment changer la source d’une TV TCL ? J’ai tenté INPUT via remote.send_command mais ca passe pas non plus.

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.tcl.tvinput%2F.passthroughinput.TvPassThroughService%2FHW1413744384

Alors je ne sais pas si cela peut t’aider, de mon côté, j’ai un script qui me permet de mettre la source HDMI de ma TV TCL sur celle connectée à ma box pop HDMI2. Pour cela, je feinte en lui demandant de lancer l’application TV de ma TCL qui fait ce que je demande. Application d’origine sur ma TCL sous android. Du coup le script:

alias: HDMI2
sequence:
  - service: media_player.select_source
    data:
      source: com.tcl.tv
    target:
      device_id: 6546d32a0***********
mode: single
icon: mdi:television

Merci, j’ai tenté mais ca passe pas.

j’ai trouvé la solution, my bad, j’appelai le mauvais entity :frowning: il fallait appeler l’entity crée par android debug bridge et non celui crée par android tv

En revanche j’ai un autre soucis, il doit y avoir une subtilité.

Je veux avoir un bouton qui eteigne la tv et un autre qui l’allume.
J’ai tenté adb shell input keyevent 223, cela eteint bien la TV mais le wakeup est impossible derriere, j’ai une erreur adb: device offline

Je pense qu’il ne faut pas l’éteindre mais le mettre en veille pour pouvoir le réveiller.

Et tu connais la commande pour mettre en veille ?

Perso j’utilise une commande yaml pour cela, je ne passe pas par adb et je ne connais pas la commande adhoc. En yaml c’est un media_player.turn_off

j’utilise aussi AD B et zandroid remote (ma tv est une TCL)

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: remote.freebox_player_pop
  - square: true
    columns: 3
    type: grid
    cards:
      - show_name: true
        show_icon: false
        type: button
        tap_action:
          action: call-service
          service: remote.send_command
          target:
            entity_id: remote.freebox_player_pop
          data:
            command: OQEE
        hold_action:
          action: none
        icon: ''
        name: FREE
        show_state: false
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:arrow-up-bold
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_UP
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
      - type: button
        show_icon: false
        tap_action:
          action: none
        hold_action:
          action: none
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:arrow-left-bold
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_LEFT
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:circle
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_CENTER
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_CENTER
            hold_secs: 0.5
          target:
            entity_id: remote.living_room_tv
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:arrow-right-bold
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_RIGHT
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:arrow-left
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: BACK
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: BACK
            hold_secs: 0.5
          target:
            entity_id: remote.living_room_tv
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:arrow-down-bold
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_DOWN
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:home-outline
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: HOME
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: HOME
            hold_secs: 0.5
          target:
            entity_id: remote.living_room_tv
  - square: false
    columns: 3
    type: grid
    cards:
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:skip-previous
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: CHANNEL_DOWN
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: MEDIA_REWIND
          target:
            entity_id: remote.living_room_tv
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:play-pause
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: MEDIA_PLAY_PAUSE
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: MEDIA_STOP
          target:
            entity_id: remote.living_room_tv
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:skip-next
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: CHANNEL_UP
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: MEDIA_FAST_FORWARD
          target:
            entity_id: remote.living_room_tv
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:volume-off
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: MUTE
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:volume-medium
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: VOLUME_DOWN
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:volume-high
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: VOLUME_UP
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
  - square: false
    columns: 4
    type: grid
    cards:
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:youtube
        tap_action:
          action: call-service
          service: remote.turn_on
          data:
            activity: https://www.youtube.com
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
      - show_name: true
        show_icon: true
        type: button
        icon: mdi:netflix
        tap_action:
          action: call-service
          service: remote.turn_on
          data:
            activity: https://www.netflix.com/title
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
      - type: picture
        image: >-
          https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Amazon_Prime_Video_logo.svg/450px-Amazon_Prime_Video_logo.svg.png
        tap_action:
          action: call-service
          service: remote.turn_on
          data:
            activity: https://app.primevideo.com
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
      - type: picture
        image: >-
          https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Disney%2B_logo.svg/440px-Disney%2B_logo.svg.png
        tap_action:
          action: call-service
          service: remote.turn_on
          data:
            activity: https://www.disneyplus.com
          target:
            entity_id:
              - remote.freebox_player_pop
        hold_action:
          action: none
  - type: entity
    entity: remote.freebox_player_pop
    attribute: current_activity
    state_color: true
  - type: media-control
    entity: media_player.freebox_player_pop

voici la télécommande que j’utilise pour la freebox pop, et ça fonctionne plutôt bien. il faut juste remplacer le nom de l’entité partout par la tienne. Il y a juste le bouton FREE qui ne fonctionne pas car j’ai pas trouvé la commande qui correspond

tu passes pas par le HDMI CEC ???

Non je passe par ADB, ca marche plutot bien sauf ce sujet de turn off / on.

as tu vraiment une utilité d’allumer séparément ta TV de ton player ??? tu utilises peut être ta tv sans ton player

Bonjour,
Puis je avoir le code de cette carte stp?

Bonjour,
Pas de soucis !

Il te faut le card (disponibles dans HACS) suivant:

mushroom-media-player-card

Il faut adapter :

  • media_player.android_tv_192_168_X_X
  • media_player.smart_tv_pro
  • remote.X

il faut aussi créer un subview pour le boutons chaines car il fait un naviguer vers un subview où il y a les chaines

type: vertical-stack
cards:
  - type: custom:mushroom-media-player-card
    entity: media_player.android_tv_192_168_X_X
    show_volume_level: false
    volume_controls:
      - volume_buttons
      - volume_mute
    fill_container: false
    icon_type: entity-picture
    use_media_info: false
    name: TV Salon
    collapsible_controls: true
    media_controls:
      - on_off
  - type: entities
    entities:
      - entity: media_player.X
  - square: false
    columns: 4
    type: grid
    cards:
      - type: picture
        image: https://x96.fr/wp-content/uploads/2020/12/tivimate-logo.png
        tap_action:
          action: call-service
          service: media_player.select_source
          target:
            entity_id: media_player.android_tv_192_168_X_X
          data:
            source: ar.tvplayer.tv
        hold_action:
          action: none
      - type: picture
        image: https://img.phonandroid.com/2021/03/netflix-codes-categories.jpg
        tap_action:
          action: call-service
          service: remote.turn_on
          target:
            entity_id: remote.X
          data:
            activity: https://www.netflix.com/title
        hold_action:
          action: none
      - type: picture
        image: https://s1.lprs1.fr/images/2020/04/17/8301381_amazon-prime-video.jpg
        tap_action:
          action: call-service
          service: remote.turn_on
          data:
            activity: https://app.primevideo.com
          target:
            entity_id: remote.X
        hold_action:
          action: none
      - type: picture
        image: >-
          https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Disney%2B_logo.svg/440px-Disney%2B_logo.svg.png
        tap_action:
          action: call-service
          service: remote.turn_on
          data:
            activity: https://www.disneyplus.com
          target:
            entity_id: remote.X
        hold_action:
          action: none
      - type: picture
        image: https://www.static.rtbf.be/tv/media/images/rtbf-auvio-logo-share.png
        tap_action:
          action: call-service
          service: media_player.select_source
          target:
            entity_id: media_player.android_tv_192_168_X_X
          data:
            source: be.rtbf.auvio
        hold_action:
          action: none
      - type: picture
        image: >-
          https://images-fio.6play.fr/v2/images/3963687/raw?auto=webp&blur=0&fit=scale_crop&height=630&interlace=1&optimize=high&width=1200&hash=0c25292932f5a6ef1529ec2bbf74e9ed83206095
        tap_action:
          action: call-service
          service: media_player.select_source
          target:
            entity_id: media_player.android_tv_192_168_X_X
          data:
            source: com.tapptic.rtl.tvi
        hold_action:
          action: none
      - type: picture
        image: >-
          https://bocir-prod-bucket.s3.amazonaws.com/radios/radiofg/importrk/news/original/6048c0af5794c6.22919243.jpg
        tap_action:
          action: call-service
          service: androidtv.adb_command
          data:
            command: >-
              am start -a android.intent.action.VIEW -n
              com.spotify.tv.android/.ui.MainActivity
          target:
            entity_id: media_player.android_tv_192_168_X_X
        hold_action:
          action: none
      - type: picture
        image: >-
          https://feeds.abplive.com/onecms/images/uploaded-images/2022/01/31/0dfe05d1f843d2705c096b93ccb80e54_original.jpg?impolicy=abp_cdn&imwidth=650
        tap_action:
          action: call-service
          service: remote.turn_on
          target:
            entity_id: remote.X
          data:
            activity: https://www.youtube.com
        hold_action:
          action: none
  - type: entity
    entity: media_player.android_tv_192_168_X_X
    state_color: false
    attribute: app_name
    name: Now Playing
  - square: true
    columns: 3
    type: grid
    cards:
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: call-service
          service: androidtv.adb_command
          target:
            device_id: 41fae9a3ee94ae203b2fe8226ac58172
          data:
            command: POWER
        hold_action:
          action: none
        entity: media_player.android_tv_192_168_X_X
        icon: mdi:power
        name: Power On
        show_state: true
      - type: button
        icon: mdi:arrow-up-bold
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_UP
          target:
            entity_id: remote.X
        hold_action:
          action: none
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: navigate
          navigation_path: /lovelace/telecommande-chaine-tivimate
        hold_action:
          action: none
        entity: device_tracker.unifi_XXX
        icon: mdi:television
        name: Chaines
        show_state: false
      - type: button
        icon: mdi:arrow-left-bold
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_LEFT
          target:
            entity_id: remote.X
        hold_action:
          action: none
      - type: button
        icon: mdi:circle
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_CENTER
          target:
            entity_id: remote.X
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_CENTER
            hold_secs: 0.5
          target:
            entity_id: remote.X
      - type: button
        icon: mdi:arrow-right-bold
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_RIGHT
          target:
            entity_id: remote.X
        hold_action:
          action: none
      - type: button
        icon: mdi:arrow-left
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: BACK
          target:
            entity_id: remote.X
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: BACK
            hold_secs: 0.5
          target:
            entity_id: remote.X
      - type: button
        icon: mdi:arrow-down-bold
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: DPAD_DOWN
          target:
            entity_id: remote.X
        hold_action:
          action: none
      - type: button
        icon: mdi:home-outline
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: HOME
          target:
            entity_id: remote.X
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: HOME
            hold_secs: 0.5
          target:
            entity_id: remote.X
  - square: false
    columns: 3
    type: grid
    cards:
      - type: button
        icon: mdi:skip-previous
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: MEDIA_PREVIOUS
          target:
            entity_id: remote.X
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: MEDIA_REWIND
          target:
            entity_id: remote.X
      - type: button
        icon: mdi:play-pause
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: MEDIA_PLAY_PAUSE
          target:
            entity_id: remote.X
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: MEDIA_STOP
          target:
            entity_id: remote.X
      - type: button
        icon: mdi:skip-next
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: MEDIA_NEXT
          target:
            entity_id: remote.X
        hold_action:
          action: call-service
          service: remote.send_command
          data:
            command: MEDIA_FAST_FORWARD
          target:
            entity_id: remote.X
      - type: button
        icon: mdi:volume-off
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: MUTE
          target:
            entity_id: remote.X
        hold_action:
          action: none
      - type: button
        icon: mdi:volume-medium
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: VOLUME_DOWN
          target:
            entity_id: remote.X
        hold_action:
          action: none
      - type: button
        icon: mdi:volume-high
        tap_action:
          action: call-service
          service: remote.send_command
          data:
            command: VOLUME_UP
          target:
            entity_id: remote.X
        hold_action:
          action: none
  - type: custom:mushroom-media-player-card
    entity: media_player.android_tv_192_168_X_X
    fill_container: true
    collapsible_controls: true
    use_media_info: true
    show_volume_level: false
    media_controls:
      - on_off
    volume_controls:
      - volume_buttons
      - volume_set
    icon_type: entity-picture
    layout: vertical


1 « J'aime »

Merci pour le code et les explications. Je vais essayer de l’adapter

Bonjour à tous,

J’ai vu sur ce forum que certains avaient réussi à faire ce que je cherche, alors, je te tente ma chance :slight_smile:

J’ai une Android TV (Nvidia Shield) et j’aimerais afficher le nom des médias en cours de lecture (le nom du programme sur myCANAL, le nom de la vidéo sur YT, le nom de la série sur Netflix …) dans une carte multimédia sur mon dashbord. La cerise sur le gâteau serait d’avoir un screenshot du programme. J’ai vu que cela était possible dans ce post pour myCANAL, bien qu’il manque un preview du programme.

Du coup, j’ai installé l’intégration « Android Debug Bridge » et elle fonctionne : les apps utilisées sont reconnues, les screenshots s’affichenthors lecture de médias, et les contrôles fonctionnent. Mais quelque soit l’app, aucune trace du nom du programme en cours dans la card multimédia par défaut :
d225dcfc4ba030f31cfae4a1f7798f99a0d29d6c_2_690x246

Est-ce possible de le faire avec ADB ? Ou existe t-il une astuce ?

Un grand merci pour votre aide :slight_smile:

Bonjour à tous
j’utilise l’intégratio android debug bridge avec une fire TV (ip en 28) et ca marche bien, j’ai recupere le media_player du firetv

je souhaite en faire autant avec le player de la pop, et la je n’arrive pas a l’ajouter a ma config android debug bridge. J’ai vérifié l’ip est bonne (ip en 43).

Une idéé ? cf screenshot (je precise que le player est allumé et que j’ai essayé auto et android tv sans succes)

merci à vous

Hello

As tu activé l’option développeur sur ta pop ?

Oui en cliquant 5 fois sur Build ca m’a bien mis que le mode developpeur est activé