Firestick and Youtube

I have been trying to get my firestick to play a youtube video but cannot find a way to make this work. Unsure if I have hit a limitation of my firestick version or a misconfiguration in home assistant.

Integrated using the built in python adb service, configured via the UI, nothing special here. If I play a youtube video, I see it show up in home assistant dashboard and I can stop/start it from that card after it’s played with the remote first, so I know there’s a good level of communication and support for playing videos is there.

Home assistant version: 2023.2.5
FireStick Firmware: 9

Config 1: Play Media

service: media_player.play_media
target:
  entity_id: media_player.android_tv
data:
  media_content_id: IFY9sQqno8
  media_content_type: video/youtube
metadata: {}

Error: Entity media_player.fire_tv does not support this service.

Config 2: Cast attempt

service: media_player.play_media
target:
  entity_id: media_player.android
data:
  media_content_type: cast
  media_content_id: " { \"app_name\": \"youtube\", \"media_id\": \"IFY9sQqno8\" }"
metadata: {}

Error: Entity media_player.android_tv does not support this service.

Controlling the FireTV devices with the universal media player commands has always been hit-and-miss for me. Opening Youtube itself can be done with the media player commands:

service: media_player.select_source
data:
  source: YouTube (FireTV)
  entity_id: media_player.fire_tv

And starting specific videos can be done using adb commands:

service: androidtv.adb_command
data:
  command: |-
    am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.youtube.com/watch?v=OvVZ1dBJ6Fc"
  entity_id: media_player.fire_tv

Marked as solution because this is exactly what I needed to make this work. Couldn’t get power on/off to take but that’s a separate issue.

Fun thing I did find out, not really something I think that can be fixed through commands is the fire stick, is that when playing the video, it would prompt with which app to use, silk browser or youtube. The great thing about that option is that it’s a completely invisible marker so it took about 10 times (which I guess forced me to prove stability in the code) to actually get the thing to select always use youtube and then, bam, fully auto launching.

Thanks for the help

Can you please let me know how you got youtube to be the default app to launch YouTube links via ADB? I think I am where you are because I have seen bing, silkm and youtube launch and didnt know why until I saw your posting.