[SOLVED] Issue on playSound on a specific sink

Tags: #<Tag:0x00007efec9dcc980> #<Tag:0x00007efec9dcc868> #<Tag:0x00007efec9dcc728>

Hi community,

I’m using the Squeezebox binding version 2.4.0 on Openhab 2.4.0 (fresh apt-upgrade from today).

I successfully discovered and added my Squeezebox server and three players in PaperUI. I give different name to my players also in PaperUI. I set the player called “Bureau” as the default sink. I created a dummy rule to test my system. Here is my problem :

Test 1

rule "audioTest"
when
     Item Test_Switch changed to ON
then
     playSound("doorbell.mp3")
end 

Works well and I here the sound.

Test 2
I try to specify the sink in the playSound command :

rule "audioTest"
when
     Item Test_Switch changed to ON
then
     playSound("Bureau", "doorbell.mp3")
end 

Does not work and I get the error message :

Failed playing audio stream ‘org.eclipse.smarthome.core.audio.FileAudioStream@1cc15ac’ as no audio sink was found.

Test 3
I try this trick :

rule "audioTest"
when
     Item Test_Switch changed to ON
then
     var string Bureau = "squeezebox:squeezeboxplayer:A1907868-9399-41A3-9314-3F67D47F91B4:685b35ad6be3"
     playSound(Bureau, "doorbell.mp3")
end 

and it works well and I here the sound.

Finally, I also tried to restart openhab and even reboot the pi, without success. It seems that the things defined in PaperUI is not visible in the Squeezebox scope. But when the default sink is set to “Bureau” in PaperUI the sound is played (test 1).

What did I do wrong ? Is PaperUI not the right tool to set up this binding ?

I don’t use this binding but have you tried defining your things/items in files, rather than PaperUI, then restarting?

As you discovered, this won’t work. playSound requires the player Thing UID as the sink argument.

This isn’t a trick. It’s the way it’s designed to work. :wink:

I’m not sure what you mean by this. If you want to use a specific audio sink in the say and playSound commands, the sink argument needs to be the Thing UID (as shown in your Test 3).

So it was not a trick but a feature :wink: Thanks for the answer.

I was thinking that we can use the player name as I can see in the openhab-cli console :

openhab> smarthome:audio sinks                                                                                                                                                                      
  ApolloCuisine (squeezebox:squeezeboxplayer:A1907868-9399-41A3-9314-3F67D47F91B4:74da387e9334)
  ApolloSalon (squeezebox:squeezeboxplayer:A1907868-9399-41A3-9314-3F67D47F91B4:74da386f0a5f)
* Bureau (squeezebox:squeezeboxplayer:A1907868-9399-41A3-9314-3F67D47F91B4:685b35ad6be3)
  System Speaker (javasound)
  System Speaker (with mp3 support) (enhancedjavasound)
  Web Audio (webaudio)

So the best way to use the binding is to define a variable by player in the rule file and working with the variables in the script ?

Exactly! :smile:

Note that this is not a feature of the binding. All bindings that support AudioSink work this way.

Yes, that’s the way I do it.