So I’m trying to dynamically create a list of options based on the setting in a previous page like is documented here: http://docs.smartthings.com/en/latest/smartapp-developers-guide/preferences-and-settings.html#dynamic-preferences
preferences {
page(name: "config", title: "HTD (W)GW-SL1 Config", uninstall: true, nextPage: "active") {
section() {
input("ipAddress", "text", multiple: false, required: true, title: "IP Address:", defaultValue: "172.16.1.133")
input("tcpPort", "integer", multiple: false, required: true, title: "TCP Port:", defaultValue: 10006)
input("HTDtype", "enum", multiple: false, required: true, title: "HTD Controller:", options: ['MC-66', 'MCA-66'])
input("theHub", "hub", multiple: false, required: true, title: "Pair with SmartThings Hub:")
}
}
page(name: "active", title: "Select Active Zones and Sources", nextPage: "naming") {
section("Which zones are available?") {
input("active_zones", "enum", multiple: true, title: "Active Zones", options: controllerZones(HTDtype))
}
section("Which input sources are available?") {
input("active_sources", "enum", multiple: true, title: "Active Sources:", options: controllerSources(HTDtype))
}
}
}
// How many sources does our controller support?
private String[] controllerSources(controller) {
log.debug("finding sources for controller type: ${controller}")
switch(controller) {
case "MC-66":
return ["1", "2", "3", "4", "5", "6"]
case "MCA-66":
return ["1", "2", "3", "4", "5", "6"]
}
return []
}
// How many zones does our controller support?
private String[] controllerZones(controller) {
log.debug("finding zones for controller type: ${controller}")
switch(controller) {
case "MC-66":
return ["1", "2", "3", "4", "5", "6"]
case "MCA-66":
return ["1", "2", "3", "4", "5", "6"]
}
return []
}
However when I run that code, my debug lines are writing to the log:
11:38:36 AM: debug finding sources for controller type: null
11:38:36 AM: debug finding zones for controller type: null
I seem to be doing something wrong, but I can’t figure out for the life of me what it might be?