Preference input: Filter by Device Type


#1

I have written a SmartApp that turns on Wemo Switches/Sockets/Insights via the use of ST Virtual on/off button Switches. My input statement in preference looks like:

section(“Wemo Switches to Control”){
input “switches”, “capability.switch”, title: “Wemo Switches”, multiple: true, required: true, refreshAfterSelection:true
}

The problem is that every switch including those not handled by this app will show up when selecting switches from the list. So my question is:

Is there a way I can modify the above section/input so that only the Virtual on/off button switches I use to control Wemos appear in the selection list within the apps preferences??**


(Alex) #2

This is a way to ask for particular device type. See if you can figure out the name of your Wemo device type. Should be camel case.

input "weatherDevices", "device.smartweatherStationTile"

#3

Thank you for your reply. From your example it looks like lowercase for the first word then the spaces are stripped from the name. The device type am using is a simple “On/Off Button Tile” type. Does device.onOffButtonTile sound right
?


#4

Dang… It worked.
Again… Thank you very much.


(Bruce) #5

I think you’re looking for "capability.momentary"


#6

Actually device.onOffButtonTile works like a charm. Only (potential) problem is that this button device could be used for more than just virtual wemo devices. Selecting such switch from within the prefs of my smartapp could create havoc :frowning: