mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-24 21:04:00 +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
|
* 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.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
* Sonos Control
|
* Speaker Control
|
||||||
*
|
*
|
||||||
* Author: SmartThings
|
* Author: SmartThings
|
||||||
*
|
*
|
||||||
* Date: 2013-12-10
|
* Date: 2013-12-10
|
||||||
*/
|
*/
|
||||||
definition(
|
definition(
|
||||||
name: "Sonos Control",
|
name: "Speaker Control",
|
||||||
namespace: "smartthings",
|
namespace: "smartthings",
|
||||||
author: "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",
|
category: "SmartThings Labs",
|
||||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
||||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
||||||
)
|
)
|
||||||
|
|
||||||
preferences {
|
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") {
|
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||||
section {
|
section {
|
||||||
input "starting", "time", title: "Starting", required: false
|
input "starting", "time", title: "Starting", required: false
|
||||||
@@ -81,7 +81,7 @@ def mainPage() {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
section {
|
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) {
|
section("More options", hideable: true, hidden: true) {
|
||||||
input "volume", "number", title: "Set the volume volume", description: "0-100%", required: false
|
input "volume", "number", title: "Set the volume volume", description: "0-100%", required: false
|
||||||
@@ -201,31 +201,31 @@ private takeAction(evt) {
|
|||||||
log.debug "takeAction($actionType)"
|
log.debug "takeAction($actionType)"
|
||||||
def options = [:]
|
def options = [:]
|
||||||
if (volume) {
|
if (volume) {
|
||||||
sonos.setLevel(volume as Integer)
|
speaker.setLevel(volume as Integer)
|
||||||
options.delay = 1000
|
options.delay = 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (actionType) {
|
switch (actionType) {
|
||||||
case "Play":
|
case "Play":
|
||||||
options ? sonos.on(options) : sonos.on()
|
options ? speaker.on(options) : speaker.on()
|
||||||
break
|
break
|
||||||
case "Stop Playing":
|
case "Stop Playing":
|
||||||
options ? sonos.off(options) : sonos.off()
|
options ? speaker.off(options) : speaker.off()
|
||||||
break
|
break
|
||||||
case "Toggle Play/Pause":
|
case "Toggle Play/Pause":
|
||||||
def currentStatus = sonos.currentValue("status")
|
def currentStatus = speaker.currentValue("status")
|
||||||
if (currentStatus == "playing") {
|
if (currentStatus == "playing") {
|
||||||
options ? sonos.pause(options) : sonos.pause()
|
options ? speaker.pause(options) : speaker.pause()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
options ? sonos.play(options) : sonos.play()
|
options ? speaker.play(options) : speaker.play()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "Skip to Next Track":
|
case "Skip to Next Track":
|
||||||
options ? sonos.nextTrack(options) : sonos.nextTrack()
|
options ? speaker.nextTrack(options) : speaker.nextTrack()
|
||||||
break
|
break
|
||||||
case "Play Previous Track":
|
case "Play Previous Track":
|
||||||
options ? sonos.previousTrack(options) : sonos.previousTrack()
|
options ? speaker.previousTrack(options) : speaker.previousTrack()
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
log.error "Action type '$actionType' not defined"
|
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
|
* 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.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
* Sonos Mood Music
|
* Speaker Mood Music
|
||||||
*
|
*
|
||||||
* Author: SmartThings
|
* Author: SmartThings
|
||||||
* Date: 2014-02-12
|
* Date: 2014-02-12
|
||||||
@@ -31,7 +31,7 @@ private songOptions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Query for recent tracks
|
// 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}
|
def dataMaps = states.collect{it.jsonValue}
|
||||||
options.addAll(dataMaps.collect{it.station})
|
options.addAll(dataMaps.collect{it.station})
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ private saveSelectedSong() {
|
|||||||
try {
|
try {
|
||||||
def thisSong = song
|
def thisSong = song
|
||||||
log.info "Looking for $thisSong"
|
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"
|
log.info "Searching ${songs.size()} records"
|
||||||
|
|
||||||
def data = songs.find {s -> s.station == thisSong}
|
def data = songs.find {s -> s.station == thisSong}
|
||||||
@@ -65,7 +65,7 @@ private saveSelectedSong() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
definition(
|
definition(
|
||||||
name: "Sonos Mood Music",
|
name: "Speaker Mood Music",
|
||||||
namespace: "smartthings",
|
namespace: "smartthings",
|
||||||
author: "SmartThings",
|
author: "SmartThings",
|
||||||
description: "Plays a selected song or station.",
|
description: "Plays a selected song or station.",
|
||||||
@@ -75,7 +75,7 @@ definition(
|
|||||||
)
|
)
|
||||||
|
|
||||||
preferences {
|
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: "chooseTrack", title: "Select a song", install: true)
|
||||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||||
section {
|
section {
|
||||||
@@ -125,7 +125,7 @@ def mainPage() {
|
|||||||
ifUnset "timeOfDay", "time", title: "At a Scheduled Time", required: false
|
ifUnset "timeOfDay", "time", title: "At a Scheduled Time", required: false
|
||||||
}
|
}
|
||||||
section {
|
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) {
|
section("More options", hideable: true, hidden: true) {
|
||||||
input "volume", "number", title: "Set the volume", description: "0-100%", required: false
|
input "volume", "number", title: "Set the volume", description: "0-100%", required: false
|
||||||
@@ -248,13 +248,13 @@ private takeAction(evt) {
|
|||||||
log.info "Playing '$state.selectedSong"
|
log.info "Playing '$state.selectedSong"
|
||||||
|
|
||||||
if (volume != null) {
|
if (volume != null) {
|
||||||
sonos.stop()
|
speaker.stop()
|
||||||
pause(500)
|
pause(500)
|
||||||
sonos.setLevel(volume)
|
speaker.setLevel(volume)
|
||||||
pause(500)
|
pause(500)
|
||||||
}
|
}
|
||||||
|
|
||||||
sonos.playTrack(state.selectedSong)
|
speaker.playTrack(state.selectedSong)
|
||||||
|
|
||||||
if (frequency || oncePerDay) {
|
if (frequency || oncePerDay) {
|
||||||
state[frequencyKey(evt)] = now()
|
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
|
* 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.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
* Sonos Custom Message
|
* Speaker Custom Message
|
||||||
*
|
*
|
||||||
* Author: SmartThings
|
* Author: SmartThings
|
||||||
* Date: 2014-1-29
|
* Date: 2014-1-29
|
||||||
*/
|
*/
|
||||||
definition(
|
definition(
|
||||||
name: "Sonos Notify with Sound",
|
name: "Speaker Notify with Sound",
|
||||||
namespace: "smartthings",
|
namespace: "smartthings",
|
||||||
author: "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",
|
category: "SmartThings Labs",
|
||||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
||||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
||||||
)
|
)
|
||||||
|
|
||||||
preferences {
|
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: "chooseTrack", title: "Select a song or station")
|
||||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||||
section {
|
section {
|
||||||
@@ -92,7 +92,7 @@ def mainPage() {
|
|||||||
input "message","text",title:"Play this message", required:false, multiple: false
|
input "message","text",title:"Play this message", required:false, multiple: false
|
||||||
}
|
}
|
||||||
section {
|
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) {
|
section("More options", hideable: true, hidden: true) {
|
||||||
input "resumePlaying", "bool", title: "Resume currently playing music after notification", required: false, defaultValue: 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
|
// 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}
|
def dataMaps = states.collect{it.jsonValue}
|
||||||
options.addAll(dataMaps.collect{it.station})
|
options.addAll(dataMaps.collect{it.station})
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ private saveSelectedSong() {
|
|||||||
try {
|
try {
|
||||||
def thisSong = song
|
def thisSong = song
|
||||||
log.info "Looking for $thisSong"
|
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"
|
log.info "Searching ${songs.size()} records"
|
||||||
|
|
||||||
def data = songs.find {s -> s.station == thisSong}
|
def data = songs.find {s -> s.station == thisSong}
|
||||||
@@ -277,13 +277,13 @@ private takeAction(evt) {
|
|||||||
log.trace "takeAction()"
|
log.trace "takeAction()"
|
||||||
|
|
||||||
if (song) {
|
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){
|
else if (resumePlaying){
|
||||||
sonos.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
|
speaker.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sonos.playTrackAndRestore(state.sound.uri, state.sound.duration, volume)
|
speaker.playTrackAndRestore(state.sound.uri, state.sound.duration, volume)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frequency || oncePerDay) {
|
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
|
* 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.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
* Sonos Weather Forecast
|
* Speaker Weather Forecast
|
||||||
*
|
*
|
||||||
* Author: SmartThings
|
* Author: SmartThings
|
||||||
* Date: 2014-1-29
|
* Date: 2014-1-29
|
||||||
*/
|
*/
|
||||||
definition(
|
definition(
|
||||||
name: "Sonos Weather Forecast",
|
name: "Speaker Weather Forecast",
|
||||||
namespace: "smartthings",
|
namespace: "smartthings",
|
||||||
author: "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",
|
category: "SmartThings Labs",
|
||||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
||||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
||||||
)
|
)
|
||||||
|
|
||||||
preferences {
|
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: "chooseTrack", title: "Select a song or station")
|
||||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||||
section {
|
section {
|
||||||
@@ -85,7 +85,7 @@ def mainPage() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
section {
|
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) {
|
section("More options", hideable: true, hidden: true) {
|
||||||
input "resumePlaying", "bool", title: "Resume currently playing music after weather report finishes", required: false, defaultValue: 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()
|
loadText()
|
||||||
|
|
||||||
if (song) {
|
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){
|
else if (resumePlaying){
|
||||||
sonos.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
|
speaker.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
|
||||||
}
|
}
|
||||||
else if (volume) {
|
else if (volume) {
|
||||||
sonos.playTrackAtVolume(state.sound.uri, volume)
|
speaker.playTrackAtVolume(state.sound.uri, volume)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sonos.playTrack(state.sound.uri)
|
speaker.playTrack(state.sound.uri)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frequency || oncePerDay) {
|
if (frequency || oncePerDay) {
|
||||||
@@ -254,7 +254,7 @@ private songOptions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Query for recent tracks
|
// 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}
|
def dataMaps = states.collect{it.jsonValue}
|
||||||
options.addAll(dataMaps.collect{it.station})
|
options.addAll(dataMaps.collect{it.station})
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ private saveSelectedSong() {
|
|||||||
try {
|
try {
|
||||||
def thisSong = song
|
def thisSong = song
|
||||||
log.info "Looking for $thisSong"
|
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"
|
log.info "Searching ${songs.size()} records"
|
||||||
|
|
||||||
def data = songs.find {s -> s.station == thisSong}
|
def data = songs.find {s -> s.station == thisSong}
|
||||||
Reference in New Issue
Block a user