Without any of my doing, almost all apps I have written automatically insert the Preferences options “Assign a name” and “Set for specific mode(s)” once installed via mobile. Today, I wrote one hwever, and these options are not there. The only difference is that the app Preference section includes a dynamic page. The code is
Only single page apps get the automatic inclusion of naming the app and the mode restriction (handled by the platform, not by the app). Once you have a multi-page app, any app with a dynamic page, the app itself must provide these features, and place them in the UI where desired. Also, the app will have to handle its own restrictions in code.
There are several examples of this code floating around. The restrictions can get more complicated when you go beyond just mode to include time of day and days of week.
Thanks for the quick reply… I really have no need for a dynamic (or multiple) page but according to the documentation, to display phases, I have to use a dynamic page. The code I pasted above is (almost) directly out of the ST documentation.
I found something similar you posted that looks like…
section(“Run this phrase…”) {
input “switchedOn”, “enum”, title: “Which phrase?”, required: true, options: phrases
}
However when I run /select it I get a screen with “No devices to connect” message…
This is correct, that to get the phrases from the platform, you have to have a dynamic page. Once you have a dynamic page, then you are on your own for naming the app, etc.
Interestingly, Button Controller, ST’s app for Minimotes, supports running a phrase (now Routine). So, it doesn’t have the automatic naming and mode restriction. Every instance is called Button Controller, which is hugely confusing. I implemented Button Controller+ off that code, and included both naming it and the restrictions. You can see that code here, on Github, for examples of how to do this: https://github.com/bravenel/SmartThings/blob/master/Button%20Controller%2B