New Android component how do you send youtube links

Hi,
under the previous custom android component here Native support for Android TV / Android devices

and using the HA add-on
https://community.home-assistant.io/t/community-hass-io-add-on-adb-android-debug-bridge/

I was able to send youtube links to the youtube app on my tv

now that there is an official android component, i’m now unable to get it to work, I’ve tried the below using the androidtv.adb_command, yet nothing happens.

youtubechillhop:
   alias: Chilledhop
   sequence:
   - service: androidtv.adb_command
     data_template:
       entity_id: media_player.sony_bravia
       command: "https://www.youtube.com/watch?v=TTXFKD7fMlE"

could someone please help resolve this issue,

You can just use adb shell commands. Try the following :

youtube_video:
  alias: Play youtube video on AndroidTV
  sequence:
  - service: androidtv.adb_command
    data:
      entity_id: media_player.sony_bravia
      command: 'am start -a android.intent.action.VIEW "https://www.youtube.com/watch?v=TTXFKD7fMlE"'
1 Like

thank you

could i ask for your help with the following

   - service: androidtv.adb_command
     data:
      entity_id: media_player.sony_bravia
      command: 'am start -a android.intent.action.VIEW "https://www.youtube.com/watch?v={{ states('sensor.yt_puzzle') }}"'

when adding {{ states(‘sensor.yt_puzzle’) }} i get the following error

Error loading /config/configuration.yaml: while parsing a block mapping in "/config/./scripts/YouTube.yaml", line 40, column 7 expected <block end>, but found '<scalar>' in "/config/./scripts/YouTube.yaml", line 41, column 100

here is the sensor

- platform: scrape
  resource: 'https://www.youtube.com/feeds/videos.xml?channel_id=UCrPUg54jUy1T_wII9jgdRbg'
  name: yt_puzzle
  select: yt\:videoid

I managed to get rid of the error you receive by removing some quotes but then no video is played. I think that is because the service can’t use sensor template data. I think you can get it working with NodeRED but i don’t know if you have that installed.

Good news ! Forget my last post… I found the correct way to get it working. Please try the following and let me know if it works :

youtube_video:
  alias: Play youtube video on AndroidTV
  sequence:
  - service: androidtv.adb_command
    data_template:
      entity_id: media_player.sony_bravia
      command: am start -a android.intent.action.VIEW https://www.youtube.com/watch?v={{states('sensor.yt_puzzle')}}
1 Like

You sir are a legend

Thank you so much for taking the time to help me out.

now to figure out how to send things straight to PIP :smiley: