Update speaker-notify-with-sound.groovy
authorRahmadi Trimananda <rahmadi.trimananda@uci.edu>
Fri, 9 Aug 2019 22:46:53 +0000 (15:46 -0700)
committerGitHub Enterprise <noreply@github.uci.edu>
Fri, 9 Aug 2019 22:46:53 +0000 (15:46 -0700)
official/speaker-notify-with-sound.groovy

index 85305ad..dd94019 100755 (executable)
@@ -26,14 +26,14 @@ definition(
 )
 
 preferences {
-       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 {
                        input "starting", "time", title: "Starting", required: false
                        input "ending", "time", title: "Ending", required: false
                }
        }
+       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")
 }
 
 // input "motion", "capability.motionSensor", title: "Motion Here", required: false, multiple: true
@@ -70,7 +70,7 @@ def mainPage() {
                                ifSet "timeOfDay", "time", title: "At a Scheduled Time", required: false
                        }
                }
-               def hideable = anythingSet || app.installationState == "COMPLETE"
+               def hideable = anythingSet //|| app.installationState == "COMPLETE"
                def sectionTitle = anythingSet ? "Select additional triggers" : "Play message when..."
 
                section(sectionTitle, hideable: hideable, hidden: true){
@@ -110,16 +110,16 @@ def mainPage() {
                }
                section("More options", hideable: true, hidden: true) {
                        input "resumePlaying", "bool", title: "Resume currently playing music after notification", required: false, defaultValue: true
-                       href "chooseTrack", title: "Or play this music or radio station", description: song ? state.selectedSong?.station : "Tap to set", state: song ? "complete" : "incomplete"
+                       //href "chooseTrack", title: "Or play this music or radio station", description: song ? state.selectedSong?.station : "Tap to set", state: song ? "complete" : "incomplete"
 
                        input "volume", "number", title: "Temporarily change volume", description: "0-100%", required: false
                        input "frequency", "decimal", title: "Minimum time between actions (defaults to every event)", description: "Minutes", required: false
                        href "timeIntervalInput", title: "Only during a certain time", description: timeLabel ?: "Tap to set", state: timeLabel ? "complete" : "incomplete"
                        input "days", "enum", title: "Only on certain days of the week", multiple: true, required: false,
                                options: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
-                       if (settings.modes) {
+                       //if (settings.modes) {
                input "modes", "mode", title: "Only when mode is", multiple: true, required: false
-            }
+            //}
                        input "oncePerDay", "bool", title: "Only once per day", required: false, defaultValue: false
                }
                section([mobileOnly:true]) {
@@ -291,13 +291,13 @@ private takeAction(evt) {
        log.trace "takeAction()"
 
        if (song) {
-               sonos.playSoundAndTrack(state.sound.uri, state.sound.duration, state.selectedSong, volume)
+               //sonos.playSoundAndTrack(state.sound.uri, state.sound.duration, state.selectedSong, volume)
        }
        else if (resumePlaying){
-               sonos.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
+               //sonos.playTrackAndResume(state.sound.uri, state.sound.duration, volume)
        }
        else {
-               sonos.playTrackAndRestore(state.sound.uri, state.sound.duration, volume)
+               //sonos.playTrackAndRestore(state.sound.uri, state.sound.duration, volume)
        }
 
        if (frequency || oncePerDay) {
@@ -424,10 +424,10 @@ private loadText() {
                        break;
                case "Custom Message":
                        if (message) {
-                               state.sound = textToSpeech(message instanceof List ? message[0] : message) // not sure why this is (sometimes) needed)
+                               //state.sound = textToSpeech(message instanceof List ? message[0] : message) // not sure why this is (sometimes) needed)
                        }
                        else {
-                               state.sound = textToSpeech("You selected the custom message option but did not enter a message in the $app.label Smart App")
+                               //state.sound = textToSpeech("You selected the custom message option but did not enter a message in the $app.label Smart App")
                        }
                        break;
                default: