Sonos Custom MP3's as alerts!

I currently have Sonos to alert me when ST do actions.

But what can I do when I want sonos to play a custom sound or mp3 when an action is executed.

Example. When door opens sonos can play a 10 second custom sound (a small mp3 file).

Any ideas ?

Edit the sonos “notify with sound app” to use that as a file :smile: Look at the bottom of the code, should be pretty straight forward. You’ll have to have it hosted somewhere where sonos can find the file. Like a public google drive folder or something.

Got it !!!

Thank you!

1 Like

Has anyone modified the sonos notifywith sound smartapp (or any others) to work with an mp3 hosted on an ftp server that doesn’t require authentication? I’m trying to do this because my local wifi router will take a USB drive and share it as an FTP resource or like a windows file share (\foldername). Accessing the sound file locally seemed better for a variety of reasons. However, neither seem to work. I get the error: java.lang.NullPointerException: Cannot invoke method playTrackAndResume() on null object @ line 287

This is one example of what I was trying:

	case "Siren":
		state.sound = [uri: "ftp://192.168.1.1:21/sda1/Siren.mp3", duration: "10"]
		break;

Suggestions on how to make it work? Thanks!

HI @Dave_Bartelli, I dont think any speaker support ftp protocol, you must to publish the mp3 like http://192.168.1.1/Siren.mp3 , or your domain http://mydomain/Siren.mp3,

you need too the mp3 duration in seconds state.sound = [uri: “http://mydomain/mysound.mp3”, duration: “10”] means 10 seconds

remember to add the name to options

section{
input “actionType”, “enum”, title: “Action?”, required: true, defaultValue: “Custom Message”, options: [
“Custom Message”,
“Bell 1”,
“Bell 2”,
“Dogs Barking”,
“Fire Alarm”,
“The mail has arrived”,
“A door opened”,
“There is motion”,
“Smartthings detected a flood”,
“Smartthings detected smoke”,
“Someone is arriving”,
“Piano”,
“Lightsaber”,
“MySound”]
input “message”,“text”,title:“Play this message”, required:false, multiple: false
}

case “MySound”:
state.sound = [uri: “http://mydomain/mysound.mp3”, duration: “10”]
break;

Will not work from your FTP directory cause it dosnt support MIME objects so its a big NO.

You have some options:

Open an Amazon AWS account, free the first year and host your files there.

Open a dropbox account and make a directory public and host your mp3 there…

Open any hosting account to host your mp3

OR… simply install Apache HTTP Server at your local computer and host your file to your computer, works faster and work even if your internet goes down (work as local network).

I hope this helps.

Thanks for the replies and the details. I’ll probably go with a local web server (maybe some day the USB ports on the hub could handle a USB drive with mp3s). However, I was wondering if anyone has used mp3s hosted on google drive. When you share a file on google drive, you get a url with a guid-like alphanumeric that does not include the file name, so I don’t think the smartapp can handle the file even if it is shared with no authentication to the public. (didn’t work for me at least). There are other options as you mentioned, but was curious if there was a way to do it. Thanks again.

It’s been a while but I used to be able to set any song in my library as a custom notification through the smart app, why has that disappeared?

It worked really well for my test using a short MP3 from the “Angels with Filthy Souls” scene in Home Alone.

1 Like

Sorry for the extreme noob question, but how do you edit code of smartapps on smartthings ? i came to this thread to also make my sonos play custom mp3s for specific events

You can spare your time doing fun stuff than trying to figure out how to modify an app, as others before you have probably done it already. You can install RemindR to play custom mp3 for the events you need. Or if you insist on modifying an app to suit your needs, then check the child app code. The code to play custom mp3s is fairly simple as long as they are hosted somewhere…

Hi @SBDOBRESCU Great Smartapp, finally got it working after some help from @chippie about the buton press of Ring Doorbell sending #13000, so the smartapp does what it’s supposed to but the sounds on sonos is delayed. Can either of you assist on the below error i’m getting?

09:42:13: info delayed message is now playing
09:42:07: error message is already playing, delaying new message by 5.993 seconds (raw delay = 4.0, elapsed time = 0.007)

Thanks

Glad you made it work… and that you are enjoying the app. Please read my comment in below thread…

1 Like

I have a USB drive plugged into my router, which makes the files visible as a UNC share. I can set the Sonos URI to the file as follows:

x-file-cifs://[SHARENAME]/[FOLDER]/[MP3FILE].mp3

(Note: I don’t use SmartThings)

2 Likes

well, this comment is pretty awesome! Solid gold right there! I host it through one of my websites lol. Will use local now! IOU buddy @LordLiverpool

Finally figure out how to code this in, figured out how to run my smart app. after all set and done button press front door. no sound coming through sonos. the sound is on dropbox. i noticed that it does not autoplay when you go to the page and the default sounds do. i dont know if that is the issue. i have tried using google drive and vocaroo but that didnt work either.

Edit
finally got it to work. i signed up for aws and it auto plays on s3. after like 4-5 hours later i figured it out.

1 Like

yes the url must play the sound when you visit the the url, even not signed in and without “clicking anything”