Creating dynamic preference inputs

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?

LOL. Of course, 30sec after posting I realize my error:

The 2nd page has to be defined as a dynamic_page as thus:

def page2() {
dynamicPage(name: “page2”) {
section() { }
}
}

Are you working on connecting the HTD MCA-66 to SmartThings? If so, could you share if you completed it and the source?

I’ve been busy with other things (too many hobbies) and need to come up with a proxy to convert the REST API calls the ST can make to the raw TCP socket communication the MCA-66 expects. That said, you can check out some code here: https://github.com/synfinatic/SmartThings

There is a person that did this with the vera named newverauser without a proxy. Obviously a different platform but I have a feeling he’s working on something for SmartThings too… @newzwaveuser

NewZwaveUser - Do you have a working solution?

I’ve been talking to a bunch of people, including people at HTD. Vera doesn’t need a proxy since it supports standard TCP sockets.

Has anyone figured out how to get HTD working for SmartThings. I am not sure how similar SmartThings is to home assistant but this blog shows how it is working for home assistant. Can any of this be helpful. Unfortunately I don’t have much programming knowledge.

@synfinatic Did you ever get anywhere with this? Upgrading my wall tablets to Sharptools and was hoping to integrate my HTD Lync 12 system with this? I’ve seen the HA solutions and the solutions that HTD has by buying Homeseer, Control 4 etc but that just seems like a waste. Must be a way to integrate and program control instead of their valet app with the GW-SL1 and SmartThings

@Jason_Clemens: So I haven’t gotten anywhere with this. Too many projects and this one fell through the cracks. Now that the Smarthings app has been updated and the dev environment has changed, I’m not sure if that makes things easier or harder? IIRC, back then there was a some challenge I was going to have to get a little creative fixing, but I forget what. Wasn’t a deal breaker, but wasn’t drop in easy either.

Aaron thanks for the followup. I figured it wasn’t anything that got solved or figured out. I’m setting up Sharptools and if the coding was built and done it would have been cool to have it all on the dashboards but it’s also easy to have a tile just hyperlink launch the native app as well. Clunkier but effective as well. Thanks man!