Play youtube on smart TV

Hello,
thank for the messge. not yet. i had to postpone this, because i had other major issues. but i will get back to this , this week! and will let you know for sure. but the delay of 20 seconds didnt work.

Please share the code with us

alias: Play welcome Video Youtube
sequence:
  - service: webostv.command
    data:
      entity_id: media_player.lg_webos_smart_tv_3
      command: system.launcher/launch
      payload:
        id: youtube.leanback.v4
        contentId: n_5i_nzS1z0
    entity_id: media_player.lg_webos_smart_tv_3
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: webostv.button
    data:
      entity_id: media_player.lg_webos_smart_tv_3
      button: ENTER
    entity_id: media_player.lg_webos_smart_tv_3
mode: single
icon: 'hass:youtube'

so it still stoped at do you want to play this video

Try to raise the delay time and make sure that the ENTER command is passed properly to the TV. Get back to me

will try tomorrow then! thank you

Do u include the whole url or just the letter&numbers sequence at the end?
For some reason if i use just the latter youtube app launches but no video starts. If i use the whole url it opens the app and loads the video as a small window in the middle of a white screen.
To get it open normally i have to edit the url and replace the “watch” part with “tv” and only then it asks me if i am sure i want to play it…

It worked! the problem is in the yaml code actually when i done the code with your specifications, for some reason on the call action button enter it didnt recognize the media player. so i had to manually ad again the media player

on the picture i had to add again the media player there. because i didnt show

here is my code

alias: Play welcome Video Youtube
sequence:
  - service: webostv.command
    data:
      entity_id: media_player.lg_webos_smart_tv_3
      command: system.launcher/launch
      payload:
        id: youtube.leanback.v4
        contentId: n_5i_nzS1z0
    entity_id: media_player.lg_webos_smart_tv_3
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - service: webostv.button
    data:
      entity_id: media_player.lg_webos_smart_tv_3
      button: ENTER
    entity_id: media_player.lg_webos_smart_tv_3
mode: single
icon: 'hass:youtube'

1 Like

No you don’t include the whole URL. You just need the content id

image

and here is the code

  - service: webostv.command
    data:
      entity_id: media_player.lg_webos_smart_tv_3
      command: system.launcher/launch
      payload:
        id: youtube.leanback.v4
        contentId: XXXXXXXXXX
    entity_id: media_player.lg_webos_smart_tv_3

replace XXXXXXXX with contentID
hope that helps

I am glad you made it! Bravo!!!

1 Like

im going to make a cool automation with this and NFC tags! :slight_smile:

Thanks, this makes sense, but here if I use only the ID, youtube app opens, but no video plays.

I don’t know why this is happening
What’s the model of the TV ? And what’s the version of Youtube running on TV?

Keep my updated!
I am very interesting for NFC automations and how they can be used for home automations

well this particular case is for an airbnb house. im using this with a door sensor, so when the door opens the video starts… its a welcome video of lisbon!
but we dont want this to fire every time you open the door… so what i am going to do as soon as the tags come, is put one next to the door of that house, and when the cleaning lady finishes cleaning she will tag the nfc, and then this automation can fire! i am still not sure how to make it only fire once after the nfc command…! but a cool thing i think

The TV model is 55sm8200pla, running webos 4.9.0-53903.
The youtube app version is web_20210221_00_RC00.

show us your code plx

Very nice idea. Weldone!

If you want to fire once, go to config/helpers and create a toggle switch.

Then create a new automation which will look like this:

alias: Tag1
description: ''
trigger:
  - platform: tag
    tag_id: ced97fa8-e349-4e25-ad57-10c415658c21
condition:
  - condition: state
    entity_id: input_boolean.airbnb_promo_video
    state: 'off'
action:
  - service: input_boolean.turn_on
    data: {}
    entity_id: input_boolean.airbnb_promo_video
  - service: script.video1
    data: {}
    entity_id: script.video1
mode: single

This is the right way to do it if you want the video to fire once.
When your guest leaves after a week or so, you can have a reset automation that will reset the boolean switch to off or reset it manually.

hope that helps

1 Like

omg! thank you! ill give it a go!!!

1 Like

Doing the same thing like you:

alias: Play YT Video
sequence:
  - service: webostv.command
    data:
      entity_id: media_player.pb_s_lg
      command: system.launcher/launch
      payload:
        id: youtube.leanback.v4
        contentId: fiwXDPufstQ
    entity_id: media_player.pb_s_lg
mode: single