)
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
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){
}
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]) {
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) {
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: