Hello, I would like ta make automation where TTS is reproduced by speaker. While this action runs I want to mute or give volume to very low for all other media players (now only KODI).
Is there some way how to do it and after some delay (after the TTS message is read) and return back to previous Volume?
The way to solve this is to set the current volume to an input_number variable before you play the TTS. Then, play the TTS, then set the volume using the media_player.volume_set. You might need to use a 5 second delay or something depending on what service you are using for TTS generation.
What you’ll want to make sure of is that your media player supports the volume_level attribute. Not all of them do and I’m not sure is Kodi does or not.
and…this could cause my whole KODI media restart. because if there will be movie playing and I will make some type of snapshot it will cause media reload. Or not?
What to do if I need to handle only pause/play? Or mute/unmute?
Possibly? I’m not 100% certain. If you want to JUST capture the volume, you’ll need to go with the method I posted up above (capture the current volume into an input_number, call the TTS service, restore the volume using the media_player.volume_set service).
The easier route is going to be the scene.create service, but you should try both to see what works for you.
Hi Guys, I would like to get on board on this topic. I’ve also struggled with this and tried the snapshot entities solution. While everything works out fine in the trace, the create scene/snapshot function won’t restore volume. This is my automation;
I’m having the same issue, if I create a scene then try to restore it at the end of the automation, nothing happens. It doesn’t seem to take a snapshot of all attributes or it doesn’t reapply them. Would love to find a fix for this since this can be a pretty important feature.
I know this is a dead topic, but I had the same challenge and found this page but it did not solve it for me. I did find a solution - at least for Spotify media players - that I would like to share with anyone searching for the answer on this page. To see if you can use this solution, check the Developer Tools > States, find your media player and check if it has the volume_level attribute (also not sure if it’s always there or only if you set the volume at least once).
The key then is to use templating, defining a variable at the beginning of the script and using it later to restore the volume: