There are two rules for play video’s and playlist: Video:
plugin://plugin.video.youtube/?path=/root/video&action=play_video&videoid=$VIDEOID Playlist
plugin://plugin.video.youtube/?path=/root/video&action=play_all&playlist=$PLAYLISTID
For playlist i have it not working yet, but maybe you have a sollution for this?
Playlist are loading say kodi, finish, but kodi don’t start playing.
Hi @rmdejonge,
no promise but you could try to create a .strm file, throw in the yt playlist url then call play on that file?
See http://kodi.wiki/view/Add-on:YouTube section 2.1
I can’t really test this as I have random connectivity at the moment in the outback.
I’m guessing that the media_content_id: “plugin://plugin.video.youtube/?path=/root/video&action=play_video&videoid=$VIDEOID” is just for kodi, and not Chromecast, right? Or is that a plugin for HASS?
I’ve been trying to figure out how to pass YouTube URLs to a Chromecast for a while now!
This is a very very helpful post. I was looking for a way to run a media stored in my synology/or yourube stream via Chromecast from hass. But unless, I run something like a python SimpleHTTPServer in either Synology or my RPi (running hass) it was not possible… I then tried to run Plex in my synology but still couldn’t get a media_content_id which could play the media from Plex source via chromecast…
Then I came to this post and finally decided to run kodi to test. Well, this worked so nicely that I bought another Pi dedicated for kodi
Few months back when I started my research about smart home products, hubs, I came across hass web site but couldn’t get to a point for buying/investing for any smart home products. But for some unknown reason, I installed hass in my computer just for testing/fun and then I didn’t have a going back.
After that, now I have two pi running kodi/hass , full of smart lights occupying the house , few smart switches , motion sensors , cameras ,etc. Now the research is pretty easy, I don’t search for a product anymore, rather whatever hass supports, that should be my first preference anyway. If its not supported, its not in my list…
I am learning everyday from home assistant community some new and cool stuffs. Thank you guys… You people are awesome.
After a lot of trying, I found a working solution for sending a complete Youtube playlist to Kodi and let it auto play all the items in the list. See the code below. You’ll need to have the Youtube addon installed in Kodi and need to activate it with your Youtube account. In case you’ll prefer a random playlist order, you can change order=default to order=shuffle in the code below.
I have used your code and it works for me with no problems. Thank you for that!
However, I am trying to make it simpler for my wife to use it. Instead of having preloaded scripts for every playlist or song, I am trying to use input.text for that purpose. So the only thing I have to do is to copy the last part of the link e.g. Xud-J6IQmLI and send it to Kodi.
Here is what I have so far:
- data:
entity_id: media_player.tv
media_content_id: plugin://plugin.video.youtube/play/?video_id={{states.input_text.youtubelink.state}}
media_content_type: video
service: media_player.play_media
So far I cant make the formatting work. I am absolutely sure it is about formatting. Something to do with the quotes maybe? Anyone wants to help a fellow husband?
We have a hit!
Thank you very much!
Now I can just strip ANY url I want and keep the last part and just paste it on the frontend. I just hit execute and the video plays!
Thank you very much again.
ytplayontv:
alias: Play Youtube Link on TV
sequence:
- data_template:
entity_id: media_player.tv
media_content_id: plugin://plugin.video.youtube/play/?video_id={{states.input_text.youtubelink.state}}
media_content_type: video
service: media_player.play_media