Sonos ... Audio Sink ... Say?

You have to use one of the entries (first part of the line) returned by the command “smarthome:voice voices”. So your voice id is “voicerss:deDE” and not “VoiceRSS:deDE”. Case is probably important (not verified).
On my side, I am using in rules the “say” action with 3 parameters: text, voice and audio sink. It is working, the voice is set to “voicerss:frFR”.

For the available audio sinks, run the command “smarthome:audio sinks” and then use one of the returned values as third parameter for the say action. I only tested with Sonos as audio sink.

I did use the “lowercase” version for the voice!
I tried:

say(SayCommand.state,“voicerss:deDE”)

resulted in

17:34:04.875 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘SagEtwas’: An error occured during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.Voice.say(java.lang.String,java.lang.String) on instance: null

or

say(SayCommand.state,“voicerss:deDE”,“sonos:PLAY1:RINCON_???1400”)

resulted in

Rule ‘SagEtwas’: An error occured during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.Voice.say(java.lang.String,java.lang.String,java.lang.String) on instance: null

however

say(SayCommand.state)

is working like a charm!

I’m on build #627

1 Like

Try this: say(SayCommand.state.toString,“voicerss:deDE”)
This should work.
I know, there is something strange, say with 1 parameter takes one Object while say with 2 or 3 parameters takes one String as first parameter.
Probably something to change that I have already commented.

1 Like

Bingo!

Thanks for that hint, yes I was feeling really strange already for all that false trys!

Next thing is to incooperate a selection of the audio sink to be used by the command, I was hoping that the Name intead of the UDN could be used. So I need to populate a list with the names and then select the correspondig UDN for the say command.

Not very fancy, however working!

On a template widget in HABpanel
Lautsprecher and SayCommand are string items!

<div class="form-inline">
  <div class="form-group">
    <input type="text" class="form-control" no-snap-drag="true"
           ng-model="myvalue" ng-value="itemValue('SayCommand')"></input>
    <button type="button" class="btn btn-primary"
           ng-click="sendCmd('SayCommand', myvalue)">Sag es!</button>
  </div>
  <div class="btn-group" uib-dropdown>
  <button id="single-button" type="button" class="btn btn-primary" uib-dropdown-toggle>
    {{itemValue('Lautsprecher')}} <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="single-button">
    <li role="menuitem"><a ng-click="sendCmd('Lautsprecher', 'Küche')">Küche</a></li>
    <li role="menuitem"><a ng-click="sendCmd('Lautsprecher', 'Wohnzimmer')">Wohnzimmer</a></li>
    <li role="menuitem"><a ng-click="sendCmd('Lautsprecher', 'Gästezimmer')">Gästezimmer</a></li>

</div>

and the rule that actualy calls the “say”

rule “SaySomething”

when
Item SayCommand received update
then
var string AudioSink
switch AudioSink {
case Lautsprecher.state.toString==“Küche” : AudioSink="sonos:PLAY1:RINCON_xxx1400"
case Lautsprecher.state.toString==“Gästezimmer” : AudioSink="sonos:PLAY1:RINCON_yyy1400"
default:AudioSink=“sonos:zzz1400”
}
say(SayCommand.state.toString,“voicerss:deDE”,AudioSink)
end

I opened an issue for the different parameter type when using the different versions of the say action.
If it is accepted, I will propose a fix to expect a String in all cases.

The “funny” thing about that is, the parameter for the text is always expected as a string, at least the code looks the same for me!
The only difference migth be, that while a single string is expected, an item.state will automatically be understood as a string, while in case of other overloads, it is not.

It is now fixed.
In few days, the snapshot will no more require the .toString() whatever the say or interpret actions wihen using an item state as parameter.

The fix should be included in the snapshot 623.

@Marty56: did you create an issue? I couldn’t find one, but i’m not (yet) that familiar with github and co.
I experience wrong sample rates at both german languages, only english does work at my configuration with the simple “say” command (changing the voices through paper UI)

Please mention the TTS engine you are using.
No problem for me with Voice RSS.

Yes, with Voicerss it is working nicely. The disadvantage of this approach is that it is a cloud service.
So I would still prefer marrytts.

So open an issue for marytts in this case.

already done for some time.

can you link the issue here? i’m to stupid to find it…

three post above Kai already provided the link but for your convenience here it is

In build 644 I have tested the newly added support for the spdif interface of the playbar in combination with say and playsound.

I was expecting that the say command would be switch volume to the notificationvolume, then play the text and switch back to the spdif interface.
This is not working. In logs I am receiving no error but it seems that the TV input is not changed.

Doing the same playing music is working nicely.

I am not sure whether I have to add any further command e.g. to turn on TV on or off or whether it is just a bug.

I am sorry, I tried to implement something while I have no playbar and so no way to test it. I probably missed something.

I appreciate you trying though not having a personal benefit.
Sorry that I could not support your development better in the PR.