defaultValue

Guys,
I’m trying to predefine that all switch type will be selected for an app I’m coding.

I would like to know whether the defaultValue can work. And if so, how I can make it work

Thanks

You can’t use defaultValue for a device you want to select. Only the user can select devices during the installation of the app. This is a security mechanism.

You lock it down to a single devicetype
http://docs.smartthings.com/en/latest/smartapp-developers-guide/preferences-and-settings.html#input

capability.capabilityName can be swaped for device.deviceTypeName

If you need a example check out PlantLink-DirectMonitor.groovy or ThinkingCleanerer.groovy

Thanks for the advice, the issue is that not all switches are using the same device type (have 3 different ones)!

Thanks!!

That’s the beauty of Capabilities. They are Device Type independent. All light switches, outlets, and light bulbs support a capability of “Switch”, for example. So a smart app simply needs to look for devices that support the switch capability.