Nvidia shield (androidtv) play/paused status problem

Sorry to dig up an old thread, but I ran into this today, and figured I might as well post my configuration in case somebody will need it in the future. This is for Shield Pro:

media_player:
  - platform: androidtv
    name: Home Theater
    scan_interval: 1
    host: 192.168.1.156
    exclude_unnamed_apps: true
    state_detection_rules:
      "org.xbmc.kodi":
        - "playing":
            "media_session_state": 2
            "wake_lock_size": 2
        - "paused":
            "media_session_state": 2
            "wake_lock_size": 1
        - "standby":
            "media_session_state": 1
            "wake_lock_size": 1
      "com.netflix.ninja":
        - "media_session_state"
      "com.amazon.amazonvideo.livingroom":
        - "playing":
            "media_session_state": 3
            "wake_lock_size": 3
        - "paused":
            "media_session_state": 2
            "wake_lock_size": 1
        - "standby":
            "media_session_state": 0
            "wake_lock_size": 1
      "com.disney.disneyplus":
        - "playing":
            "media_session_state": 3
            "wake_lock_size": 3
        - "paused":
            "media_session_state": 2
            "wake_lock_size": 1
        - "standby":
            "wake_lock_size": 0

It works well enough to turn on/off lights when you pause and resume playing in any of the apps above. There are some quirks, like, for example, fast forwarding in amazon prime videos app is considered a “pause”, but it otherwise it works well.
Oh, and Disney+ initial state actually reports media_session_state as null, which is not supported by HomeAssistant configuration, since it expects an integer.

1 Like

Sorry to dig this up again, but the androidtv media player doesn’t work properly for me on my shield with plex.

If I run this to get the status of the shield:

service: androidtv.adb_command
data:
  entity_id: media_player.nvidia_shield
  command: GET_PROPERTIES

I get the following in the media_player attributes:

adb_response: >-
  {'screen_on': True, 'awake': True, 'audio_state': 'paused', 'wake_lock_size':
  2, 'current_app': None, 'media_session_state': None, 'audio_output_device':
  None, 'is_volume_muted': None, 'volume': None, 'running_apps': None,
  'hdmi_input': None}

As you can see, it says that the shield isn’t running any app, despite it actively playing a video in plex.

Is anyone else seeing this? Thanks