Displaying the correct app names on Android TV using configuration.yaml

I have an Android TV device which is connected to my HA, I would like to be able to view which app is currently playing which is does do, but its quite hard to decipher the name.

It shows names like ar.tvplayer.tv, when it should be showing TiviMate. After Googling I was able to cobble together this in my configuration.yaml file:

#androidTV
media_player:
  - platform: androidtv
    name: Dining Room TV
    device_class: androidtv
    host: 192.168.1.178
    exclude_unnamed_apps: false
    apps:
      com.google.android.apps.tv.launcherx: "Home"
      com.google.android.youtube.tv: "Youtube"
      com.amazon.amazonvideo.livingroom: "Amazon Prime Video"
      com.plexapp.android: "Plex"
      com.netflix.ninja: "Netflix"
      com.disney.disneyplus: "Disney+"
      com.spotify.tv.android: "Spotify"
      ar.tvplayer.tv: "TiviMate"
      com.teamsmart.videomanager.tv: "SmartTube"

The IP address is correct and I have restarted HA after inserting but it doesn’t seem to have taken any affect. Can someone please advise?

EDIT: HA has given me an alert saying “Unused YAML configuration for the androidtv integration” and prompting me to remove the block. I’ve obviously done something wrong. Can someone advise how to fix?

This is quite difficult to read…

Apologies, I’ve corrected this now.

I’m not clear how your TV is integrated. I use Android Debug Bridge, which has the current source app id as an attribute, for example:

ca.dstudio.atvlauncher.pro

If I wanted friendly names I’d create a template sensor something like:

  - sensor: 
      - name: "Channel"
        state: >
          {% if state_attr("media_player.android_tv_192_168_1_103", "app_id") == "com.netflix.ninja" %}
            Netflix
          {% elif state_attr("media_player.android_tv_192_168_1_103", "app_id") == "com.amazon.amazonvideo.livingroom" %}
            Amazon Prime
          {% endif %}

Edit: Although now I look at it I see there is an “app_name” attribute too, so the template wouldn’t be necessary… :roll_eyes:

Would this add a new sensor independent of my media devices? In the media player card, instead of showing the app_id I want it to show the Name of the app, or a friendly label (that I can define).

I have two Android (Shield TV) devices I want to apply this to.

So I managed to find a customisation tag that we can use to display state values in alternative “friendlier” formats. It however does work, can anyone see if this is the correct syntax or whether this isn’t the correct approach.

homeassistant:
  customize:
    media_player.dining_room_tv_shield:
      androidtv_apps:
        ar.tvplayer.tv: "TiviMate"
        com.teamsmart.videomanager.tv: "SmartTube"
        com.google.android.apps.tv.launcherx: "Home"
        com.google.android.youtube.tv: "Youtube"
        com.amazon.amazonvideo.livingroom: "Amazon Prime Video"
        com.plexapp.android: "Plex"
        com.netflix.ninja: "Netflix"
        com.disney.disneyplus: "Disney+"
        com.spotify.tv.android: "Spotify"
    media_player.living_room_tv_shield:
      androidtv_apps:
        ar.tvplayer.tv: "TiviMate"
        com.teamsmart.videomanager.tv: "SmartTube"