Occasionally either my wife or myself would close the app on our iPhones or leave the iPhone at home resulting in the “Goodbye!” phrase not being triggered. In an attempt to correct this problem I got us SmartSense sensors for our key chains. Which worked great until we both left the house in the same car and my wife left her keys at home. I know there isn’t a silver bullet for this problem but in an attempt to reduce the risk a little more. I have written a SmartApp that will report both of us as not being present as long as at least one of each of our two present sensors is not present. Now the only thing I need is for the SmartApp to trigger the “Goodbye!” phrase. Is that possible? If so can you provide some examples?
Bravenel thank you for the reply but I may still be missing something. I created the preference for the phrase but when i click on the drop down to select a phase it is blank. I even tried the SmartApp you created in the below link just incase there was something in my code that was messing things up. Any ideas?
Can you provide me the syntax for the code? I tried the below but got errors.
location.helloHome.execute."Goodbye!"
location.helloHome.execute.“I’m Back!”
location.helloHome.execute (Goodbye!)
location.helloHome.execute (I’m Back!)
Here’s how I use phrases in my version of the Big Switch Hello Home Aop
https://github.com/tierneykev/SmartThings/blob/master/HH-Momentary/HH_Trigger_wDelay.Groovy
In Preferences:
def phrases = location.helloHome?.getPhrases()*.label
if (phrases) {
phrases.sort()
section("Run These Hello Home Phrases When...") {
input "HHPhraseOn", "enum", title: "The Switch Turns On", required: true, **options: phrases**, refreshAfterSelection:true
}
}
To Set the mode
def setMode(evt){
location.helloHome.execute(settings.HHPhraseOn)
}
Sorry, about that! I lifted a snippet of code without looking at the context first. My bad!!
Look at this code below, it works for selecting Hello Home phrases:
preferences {
page(name: "selections")
}
def selections() {
dynamicPage(name: "selections", title: "First, select your phrases", uninstall: true) {
def phrases = location.helloHome?.getPhrases()*.label
section("Select HelloHome Phrase") {
input "phrase2", "enum", title: "Phrase", required: false, options: phrases
}
}
}
Sorry thought I replied yesterday but it doesn’t look like it posted. Thank you both for your help. I got it working.
The new docs on this explains working with phrases in detail:
http://smartthings.readthedocs.org/en/latest/smartapp-developers-guide/phrases.html