I thought I’d share how I got the playback of local .mp3 files working through Sonos. I added some .mp3 files to /etc/openhab/sounds and then created a new Samba share:
The crucial bit seems to be guest ok = yes. That’s what stopped the “access denied” message in Sonos. The format of the URI in my case is:
x-file-cifs:///openHAB-sounds/mysound.mp3
For Sonos, it’s important that the hostname be in capitals, apparently, and the filenames and directories need to be URL-encoded if they contain spaces or what have you.
You may want to create a separate directory with more restricted permissions for this purpose.
I don’t have a Sonos device, but every Sonos thing should have a corresponding audio sink in openHAB for the “play sound” action. openHAB then acts as a http proxy to serve sound to the Sonos device.
You shouldn’t need to do complex share. Maybe I didn’t get something, but why don’t you use this functionality ?
I don’t know anything about that functionality. This is the way I did it on my previous home automation system, so it was the easiest way to migrate my rules.
OK, indeed it’s not easy to know everything that openHAB can do.
So here is the documentation, if any of you is interested.
Just add a Sonos Thing with the help of the Sonos binding. And then you can use the play sound / play stream action with any sound in the openHAB sound directory (or any sound available on the network/internet with http). The play sound action is available in the GUI, in blockly, in the DSL, and in every JSR223 langage.
You can also play mp3 as overlay, so what is currently being played is not interrupted.
This is done by connecting to a local websocket end point for the local speaker.