Got a reply from Smartthings:
Hey Eric,
Unfortunately this is a known issue and the team is working to correct it.
Sorry for the inconvenience in the meantime. We expect to have this dealt with soon.
Kind Regards
Bummer
Got a reply from Smartthings:
Hey Eric,
Unfortunately this is a known issue and the team is working to correct it.
Sorry for the inconvenience in the meantime. We expect to have this dealt with soon.
Kind Regards
Bummer
It is easy and probably better to use your own audio files as you can make ST and Sonos say whatever you want in any voice you want. I posted files to a server I have and edited the ST Labs app and it works great. âSir Oliverâ now greets us in the morning and throughout the day, or warns us if there is an issue in our home.
On a mac you can make TTS files easily- just type whatever text you want in anything (browser, text editor, mail etc), highlight the text, right click, choose âExport to iTunes as a spoken trackâ, and choose your voice. You can download different voices in Settings: Dictation & Speech. The you have to convert the file to .mp3 in iTunes or another app. Then upload the file to the server and use the url in the code for the sons app. Works perfect.
I might make a bunch of audio files with common sayings and post the urls for people to use until ST Labs adds more features.
Still havenât figured out how to use something like dropbox to host the file as the sharing urlâs are not direct link- if anyone knows how to use something like dropbox, google drive, etc to host the audio files it might make this even easier- could potentially build a shared repository.
@ Wheeler I canât figure out for the life of me how you are uploading the audio files to Sonos, any helpful hints (sorry new to this)
The audio files donât get uploaded to Sonos. They just need to be hosted somewhere on the internet where Sonos/Smartthings can acesss them. In the case of the default Sonos apps that SmartThings built they simply uploaded audio files to Amazon S3 and specified the direct path to the audio file in the app.
def length = 5000
switch ( actionType) {
case "Bell 1":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/bell1.mp3")
break;
case "Bell 2":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/bell2.mp3")
break;
case "Dogs Barking":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/dogs.mp3")
length += 4000
break;
case "Fire Alarm":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/alarm.mp3")
length += 9000
break;
case "The mail has arrived":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/the%20mail%20has%20arrived.mp3")
break;
case "A door opened":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/a%20door%20opened.mp3")
break;
case "There is motion":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/there%20is%20motion.mp3")
break;
case "Smartthings detected a flood":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/smartthings%20detected%20a%20flood.mp3")
break;
case "Smartthings detected smoke":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/smartthings%20detected%20smoke.mp3")
break;
case "Someone is arriving":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/someone%20is%20arriving.mp3")
break;
case "Piano":
length += 11000
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/piano2.mp3")
break;
case "Lightsaber":
length += 11000
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/lightsaber.mp3")
break;
default:
log.debug "Missing Sound Choice"
break;
So youâll need to host your custom audio file somewhere (Amazon s3 is cheap and pretty easy) and then edit the Sonos Control app to include another audio track by just copying the examples above.
@ Wheeler, are you editing in the IDE under âMySmartApsâ (keeps saying access Denied) or are you doing this under âMy Devicesâ or âMy Device Typesâ
Youâll have to create a new smartapp in the IDE. You canât directly edit an app that you didnât create. Once you get to the part where it lets you start codeing on your own app there is a dropdown menu in the top right that will let you copy the code from an existing app
@MWeston followed your direction got access to the app but it still doesnât play. any thought??
/**
Sonos (Control)
Author: SmartThings
Date: 2013-12-10
*/
preferences {
section(âChoose one or more, whenâŚâ){
input âmotionâ, âcapability.motionSensorâ, title: âMotion Hereâ, required: false, multiple: true
input âcontactâ, âcapability.contactSensorâ, title: âContact Opensâ, required: false, multiple: true
input âcontactClosedâ, âcapability.contactSensorâ, title: âContact Closesâ, required: false, multiple: true
input âaccelerationâ, âcapability.accelerationSensorâ, title: âAcceleration Detectedâ, required: false, multiple: true
input âmySwitchâ, âcapability.switchâ, title: âSwitch Turned Onâ, required: false, multiple: true
input âmySwitchOffâ, âcapability.switchâ, title: âSwitch Turned Offâ, required: false, multiple: true
input âarrivalPresenceâ, âcapability.presenceSensorâ, title: âArrival Ofâ, required: false, multiple: true
input âdeparturePresenceâ, âcapability.presenceSensorâ, title: âDeparture Ofâ, required: false, multiple: true
input âsmokeâ, âcapability.smokeDetectorâ, title: âSmoke Detectedâ, required: false, multiple: true
input âwaterâ, âcapability.waterSensorâ, title: âWater Sensor Wetâ, required: false, multiple: true
input âbutton1â, âcapability.buttonâ, title: âButton Pressâ, required:false, multiple:true //remove from production
}
section(âPerform this actionâ){
input âactionTypeâ, âenumâ, title: âAction?â, required: true, options: [
âPlayâ,
âKitchenâ,
âStop Playingâ,
â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â]
}
section {
input âsonosâ, âcapability.musicPlayerâ, title: âSonos Deviceâ, required: true
}
section(âMinimum time between actions (optional, defaults to every event)â) {
input âfrequencyâ, âdecimalâ, title: âMinutesâ, required: false
}
section(âMore optionâ, expandable: false, expanded: false) {
input âvolumeâ, ânumberâ, title: âTemporarily change volumeâ, description: â0-100%â, required: false
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
subscribeToEvents()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
subscribeToEvents()
}
def subscribeToEvents() {
subscribe(contact, âcontact.openâ, eventHandler)
subscribe(contactClosed, âcontact.closedâ, eventHandler)
subscribe(acceleration, âacceleration.activeâ, eventHandler)
subscribe(motion, âmotion.activeâ, eventHandler)
subscribe(mySwitch, âswitch.onâ, eventHandler)
subscribe(mySwitchOff, âswitch.offâ, eventHandler)
subscribe(arrivalPresence, âpresence.presentâ, eventHandler)
subscribe(departurePresence, âpresence.not presentâ, eventHandler)
subscribe(smoke, âsmoke.detectedâ, eventHandler)
subscribe(smoke, âsmoke.testedâ, eventHandler)
subscribe(smoke, âcarbonMonoxide.detectedâ, eventHandler)
subscribe(water, âwater.wetâ, eventHandler)
subscribe(button1, âbutton.pushedâ, eventHandler)
}
def eventHandler(evt) {
if (frequency) {
def lastTime = state[evt.deviceId]
if (lastTime == null || now() - lastTime >= frequency * 60000) {
sendMessage(evt)
}
}
else {
takeAction(evt)
}
}
private takeAction(evt) {
log.debug âtakeAction($actionType)â
if (actionType == "Play") {
log.trace "sonos.on()"
sonos.on()
}
else if (actionType == "Stop Playing") {
log.trace "sonos.off()"
sonos.off()
}
else {
def interval = 250
def currentVolume = sonos.currentState("level")?.integerValue
def currentTrack = sonos.currentValue("trackUri")
def currentMetadata = sonos.currentValue("trackMetadata")
def currentStatus = sonos.currentValue("status")
log.trace "uri: " + currentTrack?.encodeAsHTML()
log.trace "metadata: " + currentMetadata?.encodeAsHTML()
log.trace "status: " + currentStatus?.encodeAsHTML()
log.trace "volume: " + currentVolume
log.trace "Stopping current song"
sonos.stop()
if (volume != null) {
log.trace "Setting volume to $volume"
pause(interval)
sonos.setLevel(volume)
}
pause(interval)
log.trace "Playing $actionType"
def length = 5000
switch ( actionType) {
case "Bell 1":
sonos.playTrack("http://www.mediafire.com/listen/ihed33frttx4log/kitchenlightson.mp3")
break;
case "Bell 2":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/bell2.mp3")
break;
case "Dogs Barking":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/dogs.mp3")
length += 4000
break;
case "Fire Alarm":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/alarm.mp3")
length += 9000
break;
case "The mail has arrived":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/the%20mail%20has%20arrived.mp3")
break;
case "A door opened":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/a%20door%20opened.mp3")
break;
case "There is motion":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/there%20is%20motion.mp3")
break;
case "Smartthings detected a flood":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/smartthings%20detected%20a%20flood.mp3")
break;
case "Smartthings detected smoke":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/smartthings%20detected%20smoke.mp3")
break;
case "Someone is arriving":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/someone%20is%20arriving.mp3")
break;
case "Piano":
length += 11000
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/piano2.mp3")
break;
case "Lightsaber":
length += 11000
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/lightsaber.mp3")
break;
case "kitchen":
length += 11000
sonos.playTrack("http://www.mediafire.com/listen/ihed33frttx4log/kitchenlightson.mp3")
break;
default:
log.debug "Missing Sound Choice"
break;
Hi I have been trying to get my hub updated so I can test things out but I havenât gotten a reply. If you guys have any help in a way to have this expedited that would be appreciated. I have emailed a couple times and have checked the chat a few times but no answers. Thanks for your help in advance.
@erickanasgmail-com - I was able to get your mp3 file working with the code below. I tried it first using your mediafire link but it wasnât working. Iâm guessing it is because the way mediafire links to the mp3 file. Possibly because it is going to their player and not the actual MP3 file.
I hosted your sound file in my Amazon S3 bucket and it seems to be working well via the code below. You may just want to make your own Amazon S3 account and upload the file to there, I often purge files from my account and donât want to break it on you in the future. I believe an S3 account may even be free for low volume, if not my bill is usually no more than 20 cents a month for my personal files.
/**
* Sonos (Control) - Custom
*
* Author: Mweston
* Date: 2014-01-31
*/
preferences {
section("Choose one or more, when..."){
input "motion", "capability.motionSensor", title: "Motion Here", required: false, multiple: true
input "contact", "capability.contactSensor", title: "Contact Opens", required: false, multiple: true
input "contactClosed", "capability.contactSensor", title: "Contact Closes", required: false, multiple: true
input "acceleration", "capability.accelerationSensor", title: "Acceleration Detected", required: false, multiple: true
input "mySwitch", "capability.switch", title: "Switch Turned On", required: false, multiple: true
input "mySwitchOff", "capability.switch", title: "Switch Turned Off", required: false, multiple: true
input "arrivalPresence", "capability.presenceSensor", title: "Arrival Of", required: false, multiple: true
input "departurePresence", "capability.presenceSensor", title: "Departure Of", required: false, multiple: true
input "smoke", "capability.smokeDetector", title: "Smoke Detected", required: false, multiple: true
input "water", "capability.waterSensor", title: "Water Sensor Wet", required: false, multiple: true
input "button1", "capability.button", title: "Button Press", required:false, multiple:true //remove from production
}
section("Perform this action"){
input "actionType", "enum", title: "Action?", required: true, options: [
"Play",
"Stop Playing",
"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",
"Kitchen lights activated"]
}
section {
input "sonos", "capability.musicPlayer", title: "Sonos Device", required: true
}
section("Minimum time between actions (optional, defaults to every event)") {
input "frequency", "decimal", title: "Minutes", required: false
}
section("More option", expandable: false, expanded: false) {
input "volume", "number", title: "Temporarily change volume", description: "0-100%", required: false
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
subscribeToEvents()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
subscribeToEvents()
}
def subscribeToEvents() {
subscribe(contact, "contact.open", eventHandler)
subscribe(contactClosed, "contact.closed", eventHandler)
subscribe(acceleration, "acceleration.active", eventHandler)
subscribe(motion, "motion.active", eventHandler)
subscribe(mySwitch, "switch.on", eventHandler)
subscribe(mySwitchOff, "switch.off", eventHandler)
subscribe(arrivalPresence, "presence.present", eventHandler)
subscribe(departurePresence, "presence.not present", eventHandler)
subscribe(smoke, "smoke.detected", eventHandler)
subscribe(smoke, "smoke.tested", eventHandler)
subscribe(smoke, "carbonMonoxide.detected", eventHandler)
subscribe(water, "water.wet", eventHandler)
subscribe(button1, "button.pushed", eventHandler)
}
def eventHandler(evt) {
if (frequency) {
def lastTime = state[evt.deviceId]
if (lastTime == null || now() - lastTime >= frequency * 60000) {
sendMessage(evt)
}
}
else {
takeAction(evt)
}
}
private takeAction(evt) {
log.debug "takeAction($actionType)"
if (actionType == "Play") {
log.trace "sonos.on()"
sonos.on()
}
else if (actionType == "Stop Playing") {
log.trace "sonos.off()"
sonos.off()
}
else {
def interval = 250
def currentVolume = sonos.currentState("level")?.integerValue
def currentTrack = sonos.currentValue("trackUri")
def currentMetadata = sonos.currentValue("trackMetadata")
def currentStatus = sonos.currentValue("status")
log.trace "uri: " + currentTrack?.encodeAsHTML()
log.trace "metadata: " + currentMetadata?.encodeAsHTML()
log.trace "status: " + currentStatus?.encodeAsHTML()
log.trace "volume: " + currentVolume
log.trace "Stopping current song"
sonos.stop()
if (volume != null) {
log.trace "Setting volume to $volume"
pause(interval)
sonos.setLevel(volume)
}
pause(interval)
log.trace "Playing $actionType"
def length = 5000
switch ( actionType) {
case "Bell 1":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/bell1.mp3")
break;
case "Bell 2":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/bell2.mp3")
break;
case "Dogs Barking":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/dogs.mp3")
length += 4000
break;
case "Fire Alarm":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/alarm.mp3")
length += 9000
break;
case "The mail has arrived":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/the%20mail%20has%20arrived.mp3")
break;
case "A door opened":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/a%20door%20opened.mp3")
break;
case "There is motion":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/there%20is%20motion.mp3")
break;
case "Smartthings detected a flood":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/smartthings%20detected%20a%20flood.mp3")
break;
case "Smartthings detected smoke":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/smartthings%20detected%20smoke.mp3")
break;
case "Someone is arriving":
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/someone%20is%20arriving.mp3")
break;
case "Piano":
length += 11000
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/piano2.mp3")
break;
case "Lightsaber":
length += 11000
sonos.playTrack("http://s3.amazonaws.com/smartapp-media/sonos/lightsaber.mp3")
break;
case "Kitchen lights activated":
length += 11000
sonos.playTrack("http://assets.vss.s3.amazonaws.com/kitchenlightson.mp3")
break;
default:
log.debug "Missing Sound Choice"
break;
}
sonos.play()
// Stop after allowed time
pause(length)
log.trace "Stopping $actionType"
sonos.stop()
// Reset volume
if (volume != null) {
log.trace "Restoring volume to $currentVolume"
pause(interval)
sonos.setLevel(currentVolume)
}
// Reset to original track
pause(interval)
log.trace "Setting track to '$currentTrack'"
sonos.playTrack(currentTrack)
// Resume previous status
if (currentStatus == "playing") {
log.trace "Resuming play"
pause(interval)
sonos.play()
}
else {
log.trace "Not playing because device was not playing before"
}
}
if (frequency) {
state[evt.deviceId] = now()
}
}
@MWeston, you are GENIUS! Its clearly an issue with where I am uploading in Amazon, Where are you hosting your files? I keep trying to put them here and it does not like it: https://s3.amazonaws.com/homeautomationsystem/kitchenlightson.mp3
the folder: https://console.aws.amazon.com/s3/home?region=us-east-1
@erickanasgmail-com I think where you are placing it is fine but you may have the wrong content type specified. When you go to the URL in your browser it should play the file not download it like it is doing now.
I would verify that your content type in the S3 console (under the metadata section) is set to âaudio/mpegâ⌠Mine looks like this: http://bryan.cx/wwi5/11SRQCAi
Iâm guessing that is probably the issue.
@MWeston, YOU ARE A GENIUS!!! Got it to work perfectly! Thanks My home is now controlled by J.A.R.V.I.S.
Nice! Yeah, I have to set a few more of these up also. I havenât figured out if there is a way to include multiple sonos speakers in one app. So far it looks like we have to duplicate the app for every speaker we want it to play on and I have 5. :-\
@slimvaio try emailing them again or chatting through the app, maybe your request got lost?
@mweston
Yikes! Thatâs a lot of work! Do we have to make a new app for each sound effect ?
You should be able to just add another line for each audio file but youâll have to install multiple versions of the app for each sound effect and/or each sonos speaker you have.
This thing id going to be the death of me⌠stopped working this morning and now getting this error AHHHHHHHHHHH!!
9:45:35 AM EST: error Pause times greater than 15 seconds are not permitted.
9:45:35 AM EST: trace Playing Kitchen lights activated
9:45:34 AM EST: trace Stopping current song
9:45:34 AM EST: trace volume: 45
9:45:34 AM EST: trace status: stopped
9:45:34 AM EST: trace metadata: null
case "Kitchen lights activated":
length += 11000
sonos.playTrack("https://s3.amazonaws.com/homeautomationsystem/kitchenlightson.mp3")
break;
default:
Mine is not working very well either. Iâm thinking there is a bug or smartthings servers are not updating properly.
It doesnât seem to be recognizing when you change an audio track.
I changed the audio file and completely removed the track so it is no where in the code yet it still keeps playing that track.
Yours is likely still triggering the old code which contained the audio track that I had on my amazon account but I deleted the file last night so it plays nothing.
When I switch back to the default code that Smartthings wrote and try to play one of their tracks I can see in the console log that it triggers the âa door openedâ event yet it plays the piano trackâŚ
11:42:41 AM: trace uri: http://s3.amazonaws.com/smartapp-media/sonos/piano2.mp3
11:42:41 AM: debug takeAction(A door opened)
Not sure why it is doing that. Iâll let you know if I come up with anything though.
Grrrr. I was ready to toss this thing out the window! I am glad its not just me, but sorry to hear your having the issue to. When i talked to support earlier in the week they said there is a known issue with the sonos events so they may be trying to work through some things⌠I just wish there was another way to do the sound events without using sonos⌠seems like it makes it way more complex than it should be⌠I am going to look into other avenues⌠maybe a sound board with relay or somethingâŚ
Yeah, I like the idea of using Sonos because I already have a speaker in pretty much every room of my house but there are still some kinks that need to be worked out.
It looks like the Sonos control app keeps playing the last played audio file instead of the file specified in the settings. I just started playing a Rdio song from the Sonos app, paused it and then set off an event to play âa door openedâ and it started playing the Rdio song I was listening to previously for a few seconds instead of playing âa door openedâ.
If you have an android device you can also use the Tasker app to speak whatever notifications that smartthings sends you.