Change volume when youtube open

Hi I have the Samsung S95D and Samsung Q990D and would like the soundbar to automatically change volume when I open youtube on the TV, I have the following integrations for TV and soundbar, Samsung TV
Smart, SmartThings, is this even possible?

I do that for my Xbox. Because that starting sound is really loud. So I think it will work for your tv also.

Trigger is state of tv chance to YouTube.
Action is: set volume media player to “what you want” on playbar

Could you please copy your automation

alias: Xbox series X inschakelen
description: Xbox series X inschakelen
mode: single
triggers:

  • attribute: media_title
    to: XBOX
    entity_id:
    • media_player.sony_bravia_tv_woonkamer
      trigger: state
      conditions:
  • condition: device
    device_id: c8f566c446b55890fe88e67386dd3133
    domain: media_player
    entity_id: media_player.sony_bravia_tv_woonkamer
    type: is_on
    actions:
  • data:
    volume_level: 0.04
    target:
    entity_id: media_player.sonos_woonkamer
    action: media_player.volume_set
  • choose:
    default:
    • condition: state
      entity_id: sun.sun
      state: below_horizon
    • data: {}
      target:
      entity_id: scene.woonkamer_gamen
      action: hue.activate_scene

How would I set it up, I’m still learning ha

thanks but I have want to use an built-in app on the TV but when I select the TV it doesn’t allow me to select a source

Go to developer tools. - state
Enter your Samsung tv (entity)
And it will show you what it can do.
Put your tv on YouTube. So you can see
What the attribute (YouTube name is)


Good. So YouTube is an attribute you can select YouTube. That’s good. I will post a picture that’s easier.

Thank you I appreciate it

Change Sony tv to your Samsung.
Change Xbox to YouTube. (Type as attribute shows! Its capital sensitive)

Attribute here is title. But on yours its gonna be source or media_title or source_list or app_id

Entity here is my playbar. Change that to your Samsung playbar

Look for which attribute is showing and select that.

Thanks so much, only problem now is settling soundbar as it doesn’t have media player

That will also be your Samsung tv than.

If you change your tv volume. Will that change the bar volume? If so, use your Samsung tv as a entity (where my playbar is shown)

It does so what would i enter for volume 6

So add action. Scroll down to other action.
Than select perform action. Than type set volume

Than select your tv

Than select the volume you want it on

Test the volume out. But you will see a slider like in the picture.

Set your tv to the volume you want it on.
Than go to developer tools. Go to state.
Select your tv. And it will show you where you tv is set on as volume. (Use that number)

says volume 0 so guess it doesn’t