TTS Volume depending on "base volume"


I have quite often situation in home where there is quite much noise.
And cause of the noise, i cant hear announcments from Google home TTS.

What i was thinking was to put little microphone sensors in my home and if there is much noise it could increase value of the TTS messages.

I kinda know how it should be done but for lack of my skills it just wont go to my configs :slight_smile:

What i think it should be something like this …

- service: media_player.volume_set
volume_level: !!!variable from soundsensor1!!
- service: tts.google_say
message: ‘{{ [“Message1” , "Message2 , “Message3” ] | random }}’

platform: mqtt
state_topic: “ESPD1/volume/volume”
name: “soundsensor1”
unit_of_measurement: “volume”

You get the point…Hopefully. I dont know how to use variable from some sensor.
Or even maybe like this.
If soundsensor1 = 0db then volume 0.1
if soundsensor1 = 50db then volume 0.5
if soundsensor1 = 90db then volume 1

Does this even sound good idea?