Newbie here, so sorry if this has been covered but after searching the forum I haven't found something that describes quite exactly what I am trying to do...
I have created a rule using Rule Machine in which I would like to play a specific track to one of my Sonos speakers at a certain time of day. The track I want to play is a mp3 file and it is local on my network, being served up by a NAS.
When I create the rule and choose "play track" as the action, I see where it asks to "set track name." My question is...what is it looking for here?
I was able to play the track through my Sonos app and then went into Hubitat and saw some info about the speaker while it was playing, and I saw a cifs network path. Is that what I want to put in there? Thanks!
I don't know about all that. However, if you have an RPi (or anything that runs node), you should look into node-sonos-http-api. I use it through Hubitat (using @ogiewon's http-momentary-switch). Works great and I can play designated tracks as needed in my flows.
Welcome Maxq10 !
you select in your rule what to play and where the file is located.
as you can see in my example, the file itself is located in a file server, reachable through my network.
the Symfonisk is the sonos speaker made for Ikea
Shouldn't be different in your NAS: there is a local IP and a directory.
I had trouble with this also and ended up putting the audio files on a local web server (RaspberryPi in my case). Then used Control Music Player > Play Track > http://serverIP/path/soundfile.mp3
I did, but then it stopped working randomly. I found that the logs never actually showed the track info that you are supposed to use. I had to look at the device page itself and it showed it there. No idea though why it worked for a couple days and then just stopped working.
I had set this up on a button (SmartThings Button) that I called the Christmas button. When you press the button, it dims the normal lights, turns on the Christmas Tree lights, and starts playing "All I want for Christmas" on Sonos. Since it is now after Christmas, I haven't looked into why the music part stopped working. Will try again if I find another use or next Christmas at least.
I tried you method and works perfect.
But instead of using a string, I want to use a global variable, like %globalvar%, when I use it, does not work. Do you have any Idea why? It looks like it pass the parameters but the sonos do not react..
Do you want to pass in your global variable the entire string (http://serverIP/path/file.mp3) or just the song and concatenate with the defined server/path ?
And which version of the HE are you running ? I could give a try myself, using a global variable and see how it behaves.
Hi, thanks for the tips on this thread, helped me get this working. Here is what I did incase it helps anyone...
I have a Qnap for SMB and NFS but for this connection I used WebDav.
Create a share (or share existing if you wish), I created hubitat (permissions not important yet)
FInd WebDav: Control Panel --> Applications --> Web Server --> WebDav tab
Tick enable, and you must tick "webDAV" (note1)
Tick "used dedicated port for webDav service
Tick "HTTP port number", default is 5000 for me (note2)
Click apply, wait for it to setup the service fully (including the otherwise hidden webDAV user mgmt area)
Navigate to Control Panel --> Privilege --> Shared Folders
For the target share click on the "edit shared folder permissions" icon
Select "webDAV access" from the dropdown box then tick the tick box at the bottom that starts with " Allow guests to have read access...". Then click Apply.
I avoided spaces within the file name so it looks a little neater. If I'm allowed to I'll upload a image of my rule, still new here so might not be allowed yet. So impressed this works!
Good luck!
Note1: Using "share folder permissions" as you would for windows mounts did not work for me, it always prompted for a password because the guest attribute did not transpose across to the webDAV from the shared folder permissions function. webDAV has a dedicated guests tick box that needs ticking to avoid the password enforcement.
note2: I tried https but I don't think the Sonos integration allows the secure protocol, I'm not bothered about this as it's my internal network with strict firewalls and no external access - and it's used for just one network share.