Tts volume sonos

Hi,

I’m trying to adjust the volume of my tts message on my sonos but I keep getting the error: “extra keys not allowed @ data[‘extra’]. Got None”

does anyone know a solution?

service: tts.speak
metadata: {}
data:
  cache: true
  media_player_entity_id: media_player.kantoor
  language: nl
  message: De deurbel gaat.
  extra:
    volume: 40    
target:
  entity_id: tts.google_en_com

You can’t use the volume parameter with tts.speak.

From the documentation for the Sonos integration:

You can use volume with media_player.play_media. Ensure the URL for media_content_id uses the correct TTS service. In the documentation’s example, it uses “cloud” which is Nabu Casa’s TTS service.

i tried that already but it does not give anny sound.

service: media_player.play_media
target:
  entity_id: media_player.kantoor
data:
  announce: true
  media_content_id: >
    media-source://tts/cloud?message="I am very loud"
  media_content_type: "music"
  extra:
    volume: 80

Do you have a Nabu Casa account and is your Home Assistant system connected to it?

Because, as explained in my previous post, this URL uses Nabu Casa’s TTS service.

media-source://tts/cloud?message="I am very loud"
                   ^^^^^
         Nabu Casa's TTS service 

If you are using Google Translate for TTS, then you would specify it like this:

media-source://tts/google_translate?message="I am very loud"
                   ^^^^^^^^^^^^^^^^
            Google Translate TTS service 

Which TTS service are you using? If it’s Google Translate, replace cloud with google_translate in the URL (I tested it and confirmed it works on my system).

ah, I missed that part. No, I don’t have that, so I’m looking for another solution or putting the doorbell back in. thanks for the help.

You also might want to check out Chime TTS which you can use to generate a combined sound file and TTS audio

Then simply install the Google Translate integration and then the example I posted will work. It’s as simple as that.

Thnx Nimrod, i tried this one. Alredy better but:

When tts is ready, the music volume will first increase and then return to the original level. Can I also go to the original level immediately after the TTS? Or turn the volume up for tts only.

service: chime_tts.say
metadata: {}
data:
  tts_speed: 100
  tts_pitch: 0
  message: Dit is een test!
  tts_platform: tts.google_nl_nl
  language: nl
  gender: female
  volume_level: 0.2
  announce: true
target:
  entity_id: media_player.kantoor

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