So I’m trying to rework my Goodnight Ubi app and make it work with any TTS devices. I’m also trying to make the app more user friendly and feel smoother when installing. I’ve never used pages before when creating an app, so I’m trying to learn the process.
I’ve got my app coded up and I have all the pages set. I publish it, and then install it on my phone. The installation works fine. But… the program doesn’t.
To test and make sure the logic of my program is correct I reworked the preferences section all as “sections()” instead of pages and it works, so I’m confident in the logic part of my app. I fear I’m missing something in the pages setup. Any ideas?
Here’s what I got for my prefs plus the pages:
preferences {
page(name: "pageMain")
page(name: "pageMisc")
page(name: "pageDoorWin")
page(name: "pageLightsOn")
page(name: "pageLightsOff")
page(name: "pageRoutine")
}
def pageMain() {
dynamicPage(name: "pageMain", uninstall: true) {
section() {
paragraph "Goodnight SmartHome uses a virtual button to know when to run. You will name that later on."
paragraph "To run the app, turn that device on either by manually tapping it in the mobile app, "
}
section("Setup Menu") {
href "pageMisc", title:"Setup Button and Speaker", description:"Tap to open"
href "pageDoorWin", title:"Select Doors and Windows to check", description:"Tap to open"
href "pageLightsOn", title:"Optional: Select which Lights to turn on", description:"Tap to open"
href "pageLightsOff", title:"Optional: Select which Light to turn off", description:"Tap to open"
href "pageRoutine", title:"Optional: Choose a Routine to Run", description:"Tap to open"
}
section("Options") {
label title:"Assign a name", required:false
}
}
}
def pageMisc() {
dynamicPage(name: "pageMisc", uninstall: true) {
section("Select Virtual Device here") {
input "trigger", "capability.switch", title: "Which?", required: true
}
section() {
paragraph "Next we'll need to know what device you're going to be using as your speaker."
}
section("Text-to-Speach Device") {
input "TTspeaker", "capability.speechSynthesis", title: "Select your TTS Speaker", required: true
}
}
}
def pageLightsOn() {
dynamicPage(name: "pageLightsOn", uninstall: true) {
section() {
paragraph "Select any lights you want to turn on when this app runs."
paragraph "For example maybe a hallway light leading to a bedroom."
paragraph "If you want these lights to turn off automatically later, be sure to include them in the next section that turns lights off."
}
section() {
input "onSwitches", "capability.switch", title: "Which lights?", multiple: true, required: false
}
}
}
def pageLightsOff() {
dynamicPage(name: "pageLightsOff", uninstall: true) {
section() {
paragraph "Select any lights you want to turn off when this app runs."
paragraph "You will also need to indicate how many minutes after the app starts that these lights should turn off."
}
section() {
input "theSwitches", "capability.switch", title: "Which lights?", multiple: true, required: false
input "minutes", "number", title: "After how many minutes?", required: false
}
}
}
def pageDoorWin() {
dynamicPage(name: "pageDoorWin", uninstall: true) {
section(){
paragraph "Select all the windows and doors that you want to monitor."
paragraph "SmartThings will read off the names of any selected sensor that is left open when this app runs."
}
section(){
input "doors", "capability.contactSensor", title: "Which doors/windows?", multiple: true
}
}
}
def pageRoutine() {
dynamicPage(name: "pageRoutine", title: "First, select your phrases", uninstall: true) {
def phrases = location.helloHome?.getPhrases()*.label
section() {
paragraph "If you'd like to select a Routine to run, enter it here."
}
section("Select HelloHome Phrase") {
input "phrase2", "enum", title: "Phrase", required: false, options: phrases
}
section("When would you like to run the routine??") {
input "minutes2", "number", title: "After how many minutes?", required: false
}
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
log.debug "trigger is ${trigger}"
log.debug "Do you see me?"
initialize()
}