Ambiances in HA

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

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 :slight_smile:

If you want some advices, ask me !
good luck.

I don’t own a Chromecast, I’m running Kodi on another Rasperry Pi. I think this function is not availible for Kodi…

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!

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

Wanted to say thanks for this, added to my list!

1 Like

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.

No problem. anyone else know of it it working with kodi?

For kodi ther is a new post !!!

I know, i have made that post :wink:

ahhh ok …
Sorry i didn’t see author :wink:

@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 :slight_smile:

1 Like

@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 :stuck_out_tongue:

Thanks for the reply… hmm activate button works but your play button look is pretty cool…

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