I currently do something like this in my custom smart app:
paragraph "All sensors capable of reporting power usage events"
input "ALL_POW_01", "capability.powerMeter",
multiple: true,
title: "Which power meters?"
// A little later...
subscribe(ALL_POW_01, "power", handlePowerUsageEvent)
// ...and handlePowerUsageEvent ships off all device activity to a Node-based API I'm writing
This is all well and good, but it means I have to manually add new devices to my smart app every time I get them, which I don't always remember to do.
I've scoured the docs and forums, but can't find an answer:
Is there a programmatic way of doing something like the following?
def powerDevices = getAllDevicesWithCapability('power')
I see a vaguely similar Q&A on here that recommends composite devices as a solution, but I can't find any useful documentation that explains what composite devices actually are, and what I'm able to glean from context doesn't make them seem like a fit.