Where can I control Volume on TTS for Sonos Cloud?

Hey All!

Anyone know how to add in volume control to this Yaml script?

action: media_player.play_media
target:
  entity_id: media_player.lounge_2
data:
  media_content_id: >-
    media-source://tts/cloud?message=You+have+a+visitor%21&language=en-AU&voice=NatashaNeural
  media_content_type: provider
metadata:
  title: You have a visitor!
  thumbnail: https://brands.home-assistant.io/_/cloud/logo.png
  media_class: app
  children_media_class: null
  navigateIds:
    - {}
    - media_content_type: app
      media_content_id: media-source://tts
    - media_content_type: provider
      media_content_id: >-
        media-source://tts/cloud?message=You+have+a+visitor%21&language=en-AU&voice=NatashaNeural

There’s an example in the Sonos documentation for playing announcements. It uses three keys under the data key like this:

data:
  media_content_id: >-
    media-source://tts/cloud?message=You+have+a+visitor%21&language=en-AU&voice=NatashaNeural
  media_content_type: provider
  announce: true
  extra:
    volume: 20
metadata:
  title: You have a visitor!

If you don’t want to play the TTS message as an announcement, then you would need to set the speaker’s volume, using media_player.volume_set action, before executing media_player.play_media.

Have been setting up a daily dose of dad jokes announcemnts in our house. All working good but for some reason when calling the TTS action the volume drops , so the joke is not very loud

Have tried setting speaks tk max volume before TTS : is there a config setting for TTS for sound I need to set as well?

YAML below : some elements are me testing the sound levels via different TTS…
—————-

alias: Joke Announcing (DADJOKES)
description: ""
triggers:
  - trigger: time
    at: "07:40:00"
  - trigger: time
    at: "08:40:00"
  - trigger: time
    at: "09:30:00"
conditions:
  - condition: or
    conditions:
      - condition: time
        after: "07:37:00"
        weekday:
          - fri
          - thu
          - wed
          - tue
          - mon
      - condition: time
        after: "08:37:00"
        weekday:
          - fri
          - thu
          - wed
          - tue
          - mon
      - condition: time
        after: "09:27:00"
        weekday:
          - sat
          - sun
actions:
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: 1
    target:
      entity_id:
        - media_player.cctv_announce
        - media_player.kitchen
  - action: tts.google_translate_say
    metadata: {}
    data:
      cache: false
      message: There Is A Dad Joke Incoming.... Drum roll please...
      entity_id: media_player.cctv_announce
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: 1
    target:
      device_id: d9988d3579cbf937d29d97ef3a9813a9
  - action: tts.cloud_say
    metadata: {}
    data:
      cache: false
      entity_id: media_player.kitchen
      message: "Testing loudness here "
  - action: tts.google_translate_say
    metadata: {}
    data:
      cache: false
      entity_id: media_player.cctv_announce
      message: "{{ states('sensor.joke') }}"
    enabled: false
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.4
    target:
      entity_id:
        - media_player.cctv_announce
        - media_player.kitchen
  - action: homeassistant.update_entity
    metadata: {}
    data:
      entity_id:
        - sensor.joke
  - action: tts.speak
    metadata: {}
    data:
      cache: true
      media_player_entity_id: media_player.kitchen
      message: "Testing here "
    target:
      entity_id: tts.home_assistant_cloud
    enabled: false
mode: single

Have you tried what I suggested? Any progress to report?