Sonos ... Audio Sink ... Say?

hi there

some time ago I read that it should be possible (soon) to use sonos as an audio sink and use it e.g. with an easy “say” action…

was that implemented yet? I cant find a solution how I could get the “say” action to use sonos as destination


It is implemented but not yet merged, see

Is there already a Readme on how to one will be using this feature

well its merged now :wink:
so could show up soon :smiley:

Any heads up on the config so we can test it now that is merged?

I think you need @kai to get the relvant information

@kai hey kai any manual somewhere how to use this new sonos audio sink? :smiley:
thanks :slight_smile:

Not yet, sorry…

anybody out there who got it working and give a mini introduction?

Yes, me!
I finally submitted a PR with some infos - hopefully it will soon be merged, then it will be easier to read :slight_smile:

Some other parts are already online:

As all of this is pretty new, please don’t expect it all to be smooth. Rather see it as an invitation to help improving it (code and documentation likewise!)

Great and thank you.

I did not find the description how to change the default audio sink from within a rule or also to select an audio sink within rules.

Likewise to select the different TTS voices.

probably something like:
playsound(sink, filename) sink optional
playstream(sink, url) does this command exist?
say (sink,text)

You can find the rule actions here:

Not all of them are tested yet, though.

The OH 1 wiki defines 3 different calls:

say(String text): Says the given text through Text-to-speech
say(String text, String voice): Text-to-speech with a given voice (depends on the TTS engine or voices installed in the OS)
say(String text, String voice, String device): Text-to-speech with a given voice to the given output device (only supported on Mac OS). Available voices command: say -v ?. Available devices command: say -a ?

Could we use the last one to set a voice and an audio sink using the device parameter ?

Ok i see that it is implemented in the file you pointed. Wonderful. Remains to test it.


Not clear for me
the “interpret” function?

Also not clear for me, if sink is not default, how can the user determine the getMasterVolume() of the not- default sink. TMOH user would need the ability to specify the sink in this command as well.
Or maybe I am lacking the full understanding. Would not exclude this :wink:

Meanwhile I have started to test a bit.

in rules i have the following comands

say("dies ist ein Test")
say("dies ist ein Test","marytts","sonos:PLAY1:Schlafzimmer")

I am receiving the error message
16:55:47.025 [ERROR] [se.smarthome.core.voice.VoiceManager] - Error saying ‘dies ist ein Test’: Unable to find a voice for language de

In paper ui I have set
default Source: “empty” I do not know what to put here. Does this parameter makes sense?
default Sink: enhancedjavasound

Default Text-to-Speech: marytts

Also I have marytts installed in voices section

I have tested the sequence

playSound ("sonos:PLAY1:Schlafzimmer","speechout.wav")
playSound ("sonos:PLAY1:Schlafzimmer","speechout.wav") 
playSound ("sonos:PLAY1:Schlafzimmer","speechout.wav")

It is working great!
Even with no sleeps in between the three commands.
What an improvement!!!

Note on syntax.

in playSound, the sink is firstly required,
in say(String text, String voice, String sink)

for the sake of consistence, sink maybe should also be the first. Just a thought not important.

Have tested getMasterVolume() this return 1.0 working. Good!
With setMasterVolume(0,5) user has to use a “,” instead of a “.”.
Should both be the same and I would prefer “.”

Although it seems to accept the volume using “.” I do not see an change in the actual loudness of the speaker.
I have tested it with SONOS.

1 Like

I just tested in my rules a call like this one:

say("voici un test","voicerss:frFR","sonos:PLAY5:chambre")

and it works.
Just briant. Thanks.
PS: that is with my updated version of the Voice RSS TTS engine.

@Kai: for the master volume, we need to define additional actions that would take the audio sink ID as parameter.

I asking myself whether it would not be a really good idea to have a playSound and a say action that would take the desired volume as parameter.