Trying to get back to using my sonos for TTS a bit more and I’m running into a weird situation with volume. Its super low
here is my action
- service: media_player.volume_set
data_template:
entity_id: media_player.living_room
volume_level: 0.50
- delay: 00:00:05
- service: tts.google_say
data_template:
entity_id: media_player.living_room
message: "Tracy is at {{ states('device_tracker.tracy_all') }} and is approximately {{ states('sensor.tracys_time_to_home') }} minutes from home."
I added the volume level and the delay while trying to get this figured out, and it made no difference. If I go into the sonos app and adjust the volume it also makes no difference unless I change to full volume and then back to whatever level I set in the sonosn app. But the next time the automation runs, it’s quiet again. Like make 10%.
I only have one sonos speaker so I feel like the snapshots, etc seem like too much, but maybe I’m missing something.
I really just want to be able to say something via my sound bar at a volume level I set. Tips?
I have a snapshot, set volume script, delay, TTS, delay and finally a restore snapshot. Mine is quite complicated because I have more than 1 speaker and if I’m watching TV I have it not join that speaker etc. But if you need I can post my scripts
Try this…I simplified my scripts for your purpose. Also included an input_number so you can control the volume with a slider and find the volume that is right for you. For my system, I set it at 17
input_number:
speech_volume:
name: Speech Volume
icon: mdi:message-processing
min: 1
max: 20
step: 1
script:
speech_script:
sequence:
- service: media_player.sonos_snapshot
entity_id: media_player.living_room
- delay:
seconds: 2
- service: media_player.volume_set
data_template:
entity_id: media_player.living_room
volume_level: >-
{%- set vol = states.input_number.speech_volume.state | int -%}
{%- set adjvol = vol / 50 -%}
{%- set newvolume = adjvol | float -%}
{{newvolume}}
- service: tts.google_say
data_template:
entity_id: media_player.living_room
message: "Tracy is at {{ states('device_tracker.tracy_all') }} and is approximately {{ states('sensor.tracys_time_to_home') }} minutes from home."
- wait_template: '{{ not is_state("media_player.living_room", "playing") }}'
timeout: "00:00:40"
continue_on_timeout: 'true'
- service: media_player.sonos_restore
entity_id: media_player.living_room