[Sonos] Play local mp3 media using openhab2 on linux server

I’m already somewhat desperate trying to get an openHAB2 <-> Sonos doorbell running.

What works is defining a sound, upload it into my GooglePlay Music account and play it on the fly over the web. However, in case internet is not available the doorbell is not ringing, so I need to play something on my local machine (despite the fact, that streaming delays the doorbell by multiple seconds which is not convenient).

What I tried to do is define a playURI Sonos item for my “thing”:

String Doorbell_Play_URI {channel=“xxxxx.playuri”}

and a rule which triggers the doorbell:

rule "Doorbell"
  Item Doorbell changed to OPEN
  sendCommand(Doorbell_Play_URI, "//home/robin/doorbell/doorbell_schule_3mal.mp3")

I tried the followig URIs but without success:

Do you have any recommendation for me?


I think the SONOS streams it from your server

so its not localhost…

use the IP … eg.

please also not that the Sonos binding was updated lately to work as easy audio sink
but its not documented yet how this works exactly

In fact, the server is the same as openhab is located, so localhost should be fine (I can replace it with just in case).
Which service is expected to run there? Publicly readable samba?

no sorry you dont understand it

the openhab server sends the command to SONOS … now SONOS starts to stream from //ip/path/file.mp3
it would be localhost if the MP3 would be stored on the SONOS :wink:


so take the IP and make sure SONOS has access to the file… this will work

Now I got it!! Thank you :smile:

how would the URI to a samba share look like? I don’t seem to have any luck with:
[Edit] does seem to work even though I’m not sure if I access my ftp or my samba server :smiley:

Sorry for resurrecting this thread but I’d have a question related to this. I want to play a sound on my Sonos speakers for the door bell, but whenever I send a sound to the notification or playUrl channel, the current audio is stopped and not resumed after the doorbell notification is played.

Is there a way to play the door bell notification as “overlay” to the normal audio that is playing, so it does not interrupt it? I envisage that like in my car, when the navigation system just reduces radio volume while telling me where to drive and then turns volume back to where it was and I continue listening to what I was listening before.

Thanks for any advice.

You might have to store the current state, the play the sound, then restore the previous state.
sth. like this should do:

sendCommand(Item_Sonos_Save, ON)	
sendCommand(Item_Sonos_PlayURI, "//fritz.box/fritz.nas/Musik/ding-dong.mp3")
sendCommand(Item_Sonos_Restore, "ON")

Where the items look like: (match it to your installation)

Switch Item_Sonos_Save  |{channel="sonos:PLAY1:RINCON_B8E93... 0:save"} 
String Item_Sonos_PlayURI  |{channel="sonos:PLAY1:RINCON_B8E93....0:playuri" }
Switch Item_Sonos_Restore |{channel="sonos:PLAY1:RINCON_B8E93...0:restore"}
1 Like