Var names reversed

This commit is contained in:
Yaima Valdivia
2015-11-16 12:59:53 -08:00
parent c37729242e
commit 1034cd06e6
4 changed files with 28 additions and 28 deletions

View File

@@ -81,7 +81,7 @@ def mainPage() {
] ]
} }
section { section {
input "speaker", "capability.musicPlayer", title: "Speaker music player", required: true input "sonos", "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) {
speaker.setLevel(volume as Integer) sonos.setLevel(volume as Integer)
options.delay = 1000 options.delay = 1000
} }
switch (actionType) { switch (actionType) {
case "Play": case "Play":
options ? speaker.on(options) : speaker.on() options ? sonos.on(options) : sonos.on()
break break
case "Stop Playing": case "Stop Playing":
options ? speaker.off(options) : speaker.off() options ? sonos.off(options) : sonos.off()
break break
case "Toggle Play/Pause": case "Toggle Play/Pause":
def currentStatus = speaker.currentValue("status") def currentStatus = sonos.currentValue("status")
if (currentStatus == "playing") { if (currentStatus == "playing") {
options ? speaker.pause(options) : speaker.pause() options ? sonos.pause(options) : sonos.pause()
} }
else { else {
options ? speaker.play(options) : speaker.play() options ? sonos.play(options) : sonos.play()
} }
break break
case "Skip to Next Track": case "Skip to Next Track":
options ? speaker.nextTrack(options) : speaker.nextTrack() options ? sonos.nextTrack(options) : sonos.nextTrack()
break break
case "Play Previous Track": case "Play Previous Track":
options ? speaker.previousTrack(options) : speaker.previousTrack() options ? sonos.previousTrack(options) : sonos.previousTrack()
break break
default: default:
log.error "Action type '$actionType' not defined" log.error "Action type '$actionType' not defined"

View File

@@ -31,7 +31,7 @@ private songOptions() {
} }
// Query for recent tracks // Query for recent tracks
def states = speaker.statesSince("trackData", new Date(0), [max:30]) def states = sonos.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 = speaker.statesSince("trackData", new Date(0), [max:30]).collect{it.jsonValue} def songs = sonos.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}
@@ -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 "speaker", "capability.musicPlayer", title: "On this Speaker player", required: true input "sonos", "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) {
speaker.stop() sonos.stop()
pause(500) pause(500)
speaker.setLevel(volume) sonos.setLevel(volume)
pause(500) pause(500)
} }
speaker.playTrack(state.selectedSong) sonos.playTrack(state.selectedSong)
if (frequency || oncePerDay) { if (frequency || oncePerDay) {
state[frequencyKey(evt)] = now() state[frequencyKey(evt)] = now()

View File

@@ -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 "speaker", "capability.musicPlayer", title: "On this Speaker player", required: true input "sonos", "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 = speaker.statesSince("trackData", new Date(0), [max:30]) def states = sonos.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 = speaker.statesSince("trackData", new Date(0), [max:30]).collect{it.jsonValue} def songs = sonos.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) {
speaker.playSoundAndTrack(state.sound.uri, state.sound.duration, state.selectedSong, volume) sonos.playSoundAndTrack(state.sound.uri, state.sound.duration, state.selectedSong, volume)
} }
else if (resumePlaying){ else if (resumePlaying){
speaker.playTrackAndResume(state.sound.uri, state.sound.duration, volume) sonos.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
} }
else { else {
speaker.playTrackAndRestore(state.sound.uri, state.sound.duration, volume) sonos.playTrackAndRestore(state.sound.uri, state.sound.duration, volume)
} }
if (frequency || oncePerDay) { if (frequency || oncePerDay) {

View File

@@ -85,7 +85,7 @@ def mainPage() {
) )
} }
section { section {
input "speaker", "capability.musicPlayer", title: "On this Speaker player", required: true input "sonos", "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) {
speaker.playSoundAndTrack(state.sound.uri, state.sound.duration, state.selectedSong, volume) sonos.playSoundAndTrack(state.sound.uri, state.sound.duration, state.selectedSong, volume)
} }
else if (resumePlaying){ else if (resumePlaying){
speaker.playTrackAndResume(state.sound.uri, state.sound.duration, volume) sonos.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
} }
else if (volume) { else if (volume) {
speaker.playTrackAtVolume(state.sound.uri, volume) sonos.playTrackAtVolume(state.sound.uri, volume)
} }
else { else {
speaker.playTrack(state.sound.uri) sonos.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 = speaker.statesSince("trackData", new Date(0), [max:30]) def states = sonos.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 = speaker.statesSince("trackData", new Date(0), [max:30]).collect{it.jsonValue} def songs = sonos.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}