I want to play youtube video and turn on light in diffrent color, to do that i download youtube videos in mp4 format (thanks to website converter) and i put them on my www/ directory.
To setup different ambiances in Home Assistant, i used script and scene like that
`script:
Script hiver au chaud
hiver:
alias: Hiver
sequence:
- alias: Media play hiver
service: media_player.play_media
data:
entity_id: media_player.chromecast2
media_content_type: video/mp4
media_content_id: https://[SERVER]local/fireplace.mp4
- alias: Allume rouge
service: scene.turn_on
data:
entity_id: scene.RougeLove
forest:
alias: Forest
sequence:
- alias: Media play forest
service: media_player.play_media
data:
entity_id: media_player.chromecast2
media_content_type: video/mp4
media_content_id: https://[SERVER]/local/forest.mp4
- alias: Allume vert
service: scene.turn_on
data:
entity_id: scene.forest
sexy:
alias: Sexy
sequence:
- alias: Media play sexy
service: media_player.play_media
data:
entity_id: media_player.chromecast2
media_content_type: video/mp4
media_content_id: https://[SERVER]/local/sexy.mp4
- alias: Allume rouge
service: scene.turn_on
data:
entity_id: scene.RougeLove
ocean:
alias: Ocean
sequence:
- alias: Media play sexy
service: media_player.play_media
data:
entity_id: media_player.chromecast2
media_content_type: video/mp4
media_content_id: https://[SERVER]/local/ocean.mp4
- alias: Allume bleu
service: scene.turn_on
data:
entity_id: scene.Salon_soft
`
customization.yaml
scene.allume: friendly_name: lumieres On entity_picture: /local/light-on.png scene.eteint: friendly_name: lumieres Off entity_picture: /local/light-off.png scene.allume_tout: friendly_name: prises on entity_picture: /local/plug_on.png scene.eteint_tout: friendly_name: prises off entity_picture: /local/plug_off.png scene.rougelove: friendly_name: ambiance red entity_picture: /local/light_red.png scene.salon_soft: friendly_name: ambiance tamisée entity_picture: /local/light_blue.png scene.salon_normal: friendly_name: ambiance normale entity_picture: /local/light_yellow.png scene.forest: friendly_name: ambiance green entity_picture: /local/light_green.png script.forest: friendly_name : La foret entity_picture: /local/forest.jpg script.hiver: friendly_name: Feu de cheminée entity_picture: /local/fire.png script.ocean: friendly_name: Ocean entity_picture: /local/mer.jpg
and i configure group with scene and scripts
ambiance: name: Ambiances entities: - script.ocean - script.forest - script.hiver - scene.Salon_normal - scene.RougeLove - scene.Salon_soft - scene.forest - scene.Allume - scene.Eteint
and this is the result
4 Likes
hsch0
May 18, 2016, 5:54pm
2
nice! Does this only work with a Chromecast?
Hi hsch0,
Yes it works with chromecast.
I don’t find how to launch a youtube video so i decide to encode youtube video with online service…
I got different videos with mp4 format, stocked on my rasberry pi2 in /local/ directory (directory www).
With this scripts the video is launched on my chromecast with no issues
If you want some advices, ask me !
good luck.
hsch0
May 19, 2016, 7:15pm
4
I don’t own a Chromecast, I’m running Kodi on another Rasperry Pi. I think this function is not availible for Kodi…
rpitera
(Robert Pitera)
May 21, 2016, 1:20pm
5
I keep coming back to this post, wanting to try it. But I think I need to get a few more scenes under my belt before I try it. But it looks very cool!
Dracoy
(Dracoy)
June 5, 2016, 4:56pm
6
Oh this looks like exactly what I need. Do you happen to have the yaml files so I can see the indents? Thanks!
Hi,
For Ocean scene i used this video
For the forest scene i used this video
And for the fireplace that
I used this website to encode videos to mp4
In bonus i offer this scene that i call it “sexy scene”
1 Like
Dracoy
(Dracoy)
June 25, 2016, 11:50pm
9
Wanted to say thanks for this, added to my list!
1 Like
rmdejonge
(Rmdejonge)
June 30, 2016, 10:17am
10
Is this also posible with Kodi player? I have try but i get errors…
I don’t know i use plex and chromecast as media_player.
Sorry for that.
rmdejonge
(Rmdejonge)
June 30, 2016, 11:56am
12
No problem. anyone else know of it it working with kodi?
For kodi ther is a new post !!!
I have input_boolean in Home Assistant to play Youtube songs with Kodi. Take this steps:
[image]
[image]
Open Kodi
Settings
Add-ons
Kodi add-on repository
Video Add-ons
YouTube
Install
Open Youtube add-on and choose sign in.
Go to www.youtube.com/activeate to active your youtube plugin by typing the code.
Search a youtube movie you like and copy the video id:
[image]
This is a example from my code:
Mediaplayer.yaml:
platform: kodi
host: http://192.168.2.12
port: 80…
rmdejonge
(Rmdejonge)
July 7, 2016, 9:01am
14
I know, i have made that post
ahhh ok …
Sorry i didn’t see author
tarikul
(MD TARIKUL HAUQUE)
August 29, 2016, 7:48am
16
@hokagegano did you use plex as a media source for your Chromecast ? I cant integrate Plex into HASS. Sometimes it is discovered sometimes its not. But, I am not much into discovering Plex rather want to cast media from plex though Chromecast from Home Assistant Control. But I am unable to do so… I don’t understant what should be the media_content_id if a media streamed from a Plex server.
If that part can be understood, I believe the media_player.play_media with the right media_content_id should work.
Thanks in advance.
Hi @tarikul ,
No it’s not on plex …
I have a plex server, but my videos are on my server in mp4.
I play it on my chromecast, plex don’t decode it.
service: media_player.play_media
data:
entity_id: media_player.chromecast2
media_content_type: video/mp4
media_content_id: https://[SERVER]/local/ocean.mp4
it’s only the play_media service on the media_player component
1 Like
tarikul
(MD TARIKUL HAUQUE)
September 16, 2016, 11:32pm
18
@hokagegano Nice project mate. I am finally able to do a similar kind of stuff via Kodi and from YouTube.
Just a silly question… how did you change the view of the scripts in front-end? If I follow the similar config as you, the entity picture comes on the left and on right the activate is still there.I can’t move the activate thing from my front-end.
Thanks
Tarikul
I think that provide from a change of config from HA.
Before i had a play symbol but now it’s only activate button …
it works anyway
tarikul
(MD TARIKUL HAUQUE)
September 18, 2016, 2:04pm
20
Thanks for the reply… hmm activate button works but your play button look is pretty cool…
broesie
(Ryoen Deprouw)
December 15, 2016, 4:00pm
21
It doesnt work: chromecast won’t play the file…
I used this code:
- service: media_player.play_media
data:
entity_id: media_player.living
media_content_type: video/mp4
media_content_id: /local/fireplace.mp4
The icon of cast will show on my tv, but it does not play the file.
I put the video on the www folder.
At the frontend I used also a picture icon, and that will load correctly. The video is in the same folder, and that would not be played… very strange…
script.fireplace:
friendly_name: Haard
entity_picture: /local/fire.jpg
Also I’m using chromecast ultra…
1 Like