mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-13 13:21:53 +00:00
Rename Sonos SmartApps
https://smartthings.atlassian.net/browse/DVCSMP-607
This commit is contained in:
@@ -10,24 +10,24 @@
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing permissions and limitations under the License.
|
||||
*
|
||||
* Sonos Control
|
||||
* Speaker Control
|
||||
*
|
||||
* Author: SmartThings
|
||||
*
|
||||
* Date: 2013-12-10
|
||||
*/
|
||||
definition(
|
||||
name: "Sonos Control",
|
||||
name: "Speaker Control",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Play or pause your Sonos when certain actions take place in your home.",
|
||||
description: "Play or pause your Speaker when certain actions take place in your home.",
|
||||
category: "SmartThings Labs",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
||||
)
|
||||
|
||||
preferences {
|
||||
page(name: "mainPage", title: "Control your Sonos when something happens", install: true, uninstall: true)
|
||||
page(name: "mainPage", title: "Control your Speaker when something happens", install: true, uninstall: true)
|
||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||
section {
|
||||
input "starting", "time", title: "Starting", required: false
|
||||
@@ -81,7 +81,7 @@ def mainPage() {
|
||||
]
|
||||
}
|
||||
section {
|
||||
input "sonos", "capability.musicPlayer", title: "Sonos music player", required: true
|
||||
input "speaker", "capability.musicPlayer", title: "Speaker music player", required: true
|
||||
}
|
||||
section("More options", hideable: true, hidden: true) {
|
||||
input "volume", "number", title: "Set the volume volume", description: "0-100%", required: false
|
||||
@@ -201,31 +201,31 @@ private takeAction(evt) {
|
||||
log.debug "takeAction($actionType)"
|
||||
def options = [:]
|
||||
if (volume) {
|
||||
sonos.setLevel(volume as Integer)
|
||||
speaker.setLevel(volume as Integer)
|
||||
options.delay = 1000
|
||||
}
|
||||
|
||||
switch (actionType) {
|
||||
case "Play":
|
||||
options ? sonos.on(options) : sonos.on()
|
||||
options ? speaker.on(options) : speaker.on()
|
||||
break
|
||||
case "Stop Playing":
|
||||
options ? sonos.off(options) : sonos.off()
|
||||
options ? speaker.off(options) : speaker.off()
|
||||
break
|
||||
case "Toggle Play/Pause":
|
||||
def currentStatus = sonos.currentValue("status")
|
||||
def currentStatus = speaker.currentValue("status")
|
||||
if (currentStatus == "playing") {
|
||||
options ? sonos.pause(options) : sonos.pause()
|
||||
options ? speaker.pause(options) : speaker.pause()
|
||||
}
|
||||
else {
|
||||
options ? sonos.play(options) : sonos.play()
|
||||
options ? speaker.play(options) : speaker.play()
|
||||
}
|
||||
break
|
||||
case "Skip to Next Track":
|
||||
options ? sonos.nextTrack(options) : sonos.nextTrack()
|
||||
options ? speaker.nextTrack(options) : speaker.nextTrack()
|
||||
break
|
||||
case "Play Previous Track":
|
||||
options ? sonos.previousTrack(options) : sonos.previousTrack()
|
||||
options ? speaker.previousTrack(options) : speaker.previousTrack()
|
||||
break
|
||||
default:
|
||||
log.error "Action type '$actionType' not defined"
|
||||
@@ -10,7 +10,7 @@
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing permissions and limitations under the License.
|
||||
*
|
||||
* Sonos Mood Music
|
||||
* Speaker Mood Music
|
||||
*
|
||||
* Author: SmartThings
|
||||
* Date: 2014-02-12
|
||||
@@ -31,7 +31,7 @@ private songOptions() {
|
||||
}
|
||||
|
||||
// Query for recent tracks
|
||||
def states = sonos.statesSince("trackData", new Date(0), [max:30])
|
||||
def states = speaker.statesSince("trackData", new Date(0), [max:30])
|
||||
def dataMaps = states.collect{it.jsonValue}
|
||||
options.addAll(dataMaps.collect{it.station})
|
||||
|
||||
@@ -43,7 +43,7 @@ private saveSelectedSong() {
|
||||
try {
|
||||
def thisSong = song
|
||||
log.info "Looking for $thisSong"
|
||||
def songs = sonos.statesSince("trackData", new Date(0), [max:30]).collect{it.jsonValue}
|
||||
def songs = speaker.statesSince("trackData", new Date(0), [max:30]).collect{it.jsonValue}
|
||||
log.info "Searching ${songs.size()} records"
|
||||
|
||||
def data = songs.find {s -> s.station == thisSong}
|
||||
@@ -65,7 +65,7 @@ private saveSelectedSong() {
|
||||
}
|
||||
|
||||
definition(
|
||||
name: "Sonos Mood Music",
|
||||
name: "Speaker Mood Music",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Plays a selected song or station.",
|
||||
@@ -75,7 +75,7 @@ definition(
|
||||
)
|
||||
|
||||
preferences {
|
||||
page(name: "mainPage", title: "Play a selected song or station on your Sonos when something happens", nextPage: "chooseTrack", uninstall: true)
|
||||
page(name: "mainPage", title: "Play a selected song or station on your Speaker when something happens", nextPage: "chooseTrack", uninstall: true)
|
||||
page(name: "chooseTrack", title: "Select a song", install: true)
|
||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||
section {
|
||||
@@ -125,7 +125,7 @@ def mainPage() {
|
||||
ifUnset "timeOfDay", "time", title: "At a Scheduled Time", required: false
|
||||
}
|
||||
section {
|
||||
input "sonos", "capability.musicPlayer", title: "On this Sonos player", required: true
|
||||
input "speaker", "capability.musicPlayer", title: "On this Speaker player", required: true
|
||||
}
|
||||
section("More options", hideable: true, hidden: true) {
|
||||
input "volume", "number", title: "Set the volume", description: "0-100%", required: false
|
||||
@@ -248,13 +248,13 @@ private takeAction(evt) {
|
||||
log.info "Playing '$state.selectedSong"
|
||||
|
||||
if (volume != null) {
|
||||
sonos.stop()
|
||||
speaker.stop()
|
||||
pause(500)
|
||||
sonos.setLevel(volume)
|
||||
speaker.setLevel(volume)
|
||||
pause(500)
|
||||
}
|
||||
|
||||
sonos.playTrack(state.selectedSong)
|
||||
speaker.playTrack(state.selectedSong)
|
||||
|
||||
if (frequency || oncePerDay) {
|
||||
state[frequencyKey(evt)] = now()
|
||||
@@ -10,23 +10,23 @@
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing permissions and limitations under the License.
|
||||
*
|
||||
* Sonos Custom Message
|
||||
* Speaker Custom Message
|
||||
*
|
||||
* Author: SmartThings
|
||||
* Date: 2014-1-29
|
||||
*/
|
||||
definition(
|
||||
name: "Sonos Notify with Sound",
|
||||
name: "Speaker Notify with Sound",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Play a sound or custom message through your Sonos when the mode changes or other events occur.",
|
||||
description: "Play a sound or custom message through your Speaker when the mode changes or other events occur.",
|
||||
category: "SmartThings Labs",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
||||
)
|
||||
|
||||
preferences {
|
||||
page(name: "mainPage", title: "Play a message on your Sonos when something happens", install: true, uninstall: true)
|
||||
page(name: "mainPage", title: "Play a message on your Speaker when something happens", install: true, uninstall: true)
|
||||
page(name: "chooseTrack", title: "Select a song or station")
|
||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||
section {
|
||||
@@ -92,7 +92,7 @@ def mainPage() {
|
||||
input "message","text",title:"Play this message", required:false, multiple: false
|
||||
}
|
||||
section {
|
||||
input "sonos", "capability.musicPlayer", title: "On this Sonos player", required: true
|
||||
input "speaker", "capability.musicPlayer", title: "On this Speaker player", required: true
|
||||
}
|
||||
section("More options", hideable: true, hidden: true) {
|
||||
input "resumePlaying", "bool", title: "Resume currently playing music after notification", required: false, defaultValue: true
|
||||
@@ -137,7 +137,7 @@ private songOptions() {
|
||||
}
|
||||
|
||||
// Query for recent tracks
|
||||
def states = sonos.statesSince("trackData", new Date(0), [max:30])
|
||||
def states = speaker.statesSince("trackData", new Date(0), [max:30])
|
||||
def dataMaps = states.collect{it.jsonValue}
|
||||
options.addAll(dataMaps.collect{it.station})
|
||||
|
||||
@@ -149,7 +149,7 @@ private saveSelectedSong() {
|
||||
try {
|
||||
def thisSong = song
|
||||
log.info "Looking for $thisSong"
|
||||
def songs = sonos.statesSince("trackData", new Date(0), [max:30]).collect{it.jsonValue}
|
||||
def songs = speaker.statesSince("trackData", new Date(0), [max:30]).collect{it.jsonValue}
|
||||
log.info "Searching ${songs.size()} records"
|
||||
|
||||
def data = songs.find {s -> s.station == thisSong}
|
||||
@@ -277,13 +277,13 @@ private takeAction(evt) {
|
||||
log.trace "takeAction()"
|
||||
|
||||
if (song) {
|
||||
sonos.playSoundAndTrack(state.sound.uri, state.sound.duration, state.selectedSong, volume)
|
||||
speaker.playSoundAndTrack(state.sound.uri, state.sound.duration, state.selectedSong, volume)
|
||||
}
|
||||
else if (resumePlaying){
|
||||
sonos.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
|
||||
speaker.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
|
||||
}
|
||||
else {
|
||||
sonos.playTrackAndRestore(state.sound.uri, state.sound.duration, volume)
|
||||
speaker.playTrackAndRestore(state.sound.uri, state.sound.duration, volume)
|
||||
}
|
||||
|
||||
if (frequency || oncePerDay) {
|
||||
@@ -10,23 +10,23 @@
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing permissions and limitations under the License.
|
||||
*
|
||||
* Sonos Weather Forecast
|
||||
* Speaker Weather Forecast
|
||||
*
|
||||
* Author: SmartThings
|
||||
* Date: 2014-1-29
|
||||
*/
|
||||
definition(
|
||||
name: "Sonos Weather Forecast",
|
||||
name: "Speaker Weather Forecast",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Play a weather report through your Sonos when the mode changes or other events occur",
|
||||
description: "Play a weather report through your Speaker when the mode changes or other events occur",
|
||||
category: "SmartThings Labs",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
||||
)
|
||||
|
||||
preferences {
|
||||
page(name: "mainPage", title: "Play the weather report on your sonos", install: true, uninstall: true)
|
||||
page(name: "mainPage", title: "Play the weather report on your speaker", install: true, uninstall: true)
|
||||
page(name: "chooseTrack", title: "Select a song or station")
|
||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||
section {
|
||||
@@ -85,7 +85,7 @@ def mainPage() {
|
||||
)
|
||||
}
|
||||
section {
|
||||
input "sonos", "capability.musicPlayer", title: "On this Sonos player", required: true
|
||||
input "speaker", "capability.musicPlayer", title: "On this Speaker player", required: true
|
||||
}
|
||||
section("More options", hideable: true, hidden: true) {
|
||||
input "resumePlaying", "bool", title: "Resume currently playing music after weather report finishes", required: false, defaultValue: true
|
||||
@@ -223,16 +223,16 @@ private takeAction(evt) {
|
||||
loadText()
|
||||
|
||||
if (song) {
|
||||
sonos.playSoundAndTrack(state.sound.uri, state.sound.duration, state.selectedSong, volume)
|
||||
speaker.playSoundAndTrack(state.sound.uri, state.sound.duration, state.selectedSong, volume)
|
||||
}
|
||||
else if (resumePlaying){
|
||||
sonos.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
|
||||
speaker.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
|
||||
}
|
||||
else if (volume) {
|
||||
sonos.playTrackAtVolume(state.sound.uri, volume)
|
||||
speaker.playTrackAtVolume(state.sound.uri, volume)
|
||||
}
|
||||
else {
|
||||
sonos.playTrack(state.sound.uri)
|
||||
speaker.playTrack(state.sound.uri)
|
||||
}
|
||||
|
||||
if (frequency || oncePerDay) {
|
||||
@@ -254,7 +254,7 @@ private songOptions() {
|
||||
}
|
||||
|
||||
// Query for recent tracks
|
||||
def states = sonos.statesSince("trackData", new Date(0), [max:30])
|
||||
def states = speaker.statesSince("trackData", new Date(0), [max:30])
|
||||
def dataMaps = states.collect{it.jsonValue}
|
||||
options.addAll(dataMaps.collect{it.station})
|
||||
|
||||
@@ -266,7 +266,7 @@ private saveSelectedSong() {
|
||||
try {
|
||||
def thisSong = song
|
||||
log.info "Looking for $thisSong"
|
||||
def songs = sonos.statesSince("trackData", new Date(0), [max:30]).collect{it.jsonValue}
|
||||
def songs = speaker.statesSince("trackData", new Date(0), [max:30]).collect{it.jsonValue}
|
||||
log.info "Searching ${songs.size()} records"
|
||||
|
||||
def data = songs.find {s -> s.station == thisSong}
|
||||
Reference in New Issue
Block a user