I have a dynamic page in an app that lets me choose devices to integrate with the app's child devices based on capability. It looks like this:
dynamicPage(name: "editMapPage", title: "") {
section("< h1>${currDevice.label}") {
paragraph paragraphText
capList.each { cap ->
input "integrate:$currDevice.deviceNetworkId:$cap", "${capabilityMap[cap]}", title: "$cap devices to integrate", required: false, multiple: true, submitOnChange: true
}
}
}
capList is a list of capabilities the child device has.
I am able to call commands on the selected devices using:
settings["integrate:$currDevice.deviceNetworkId:$cap"].< command name>()
This all works fine.
However, when I try to subscribe to the devices using:
subscribe(settings["integrate:$currDevice.deviceNetworkId:$cap"], integrationHandler)
Nothing happens. I do not get an error nor does the subscription appear on the application's status page. Only when I add an attribute to subscribe to does it actually subscribe.
subscribe(settings["integrate:$currDevice.deviceNetworkId:$cap"], attribute, integrationHandler)
Is there a way to subscribe to every event from the device without setting up a bunch of subscriptions for each attribute? I can set up a subscription for each attribute but I am concerned about overhead.
On a separate but related question, is there a way to remove unwanted devices from settings["integrate:$currDevice.deviceNetworkId:$cap"]? I've seen the Amazon Alexa app do that for unsupported devices. I have tried by building a new list minus the unwanted devices calling updateSetting(..., newList) but the unwanted devices remain in the list.
Also, is there a way to iterate through the application's settings? I would like to set up a clean-up routine when child devices are deleted.
Thanks in advance for any help.
Regards,
Greg