Are there any tutorials on working with multiple devices?

devices
groovy
developers

(Matthew McDermott) #1

I have tried searching for any code samples that show how to work with multiple devices (like multiple switches) and so far all I have found is that you can set “multiple:true”. Specifically, I am looking for how to check the switch statuses, set the switches and how to set the level of dimmers.

If the resulting variable is an array, how do I enumerate the array?


(Jim Anderson) #2

http://docs.smartthings.com/en/latest/smartapp-developers-guide/devices.html#interacting-with-multiple-devices

http://docs.smartthings.com/en/latest/getting-started/groovy-basics.html#lists-and-maps

http://groovy-lang.org/groovy-dev-kit.html#Collections-Lists

Also plenty of examples in the public repo: https://github.com/SmartThingsCommunity/SmartThingsPublic/search?utf8=✓&q=multiple%3Atrue&type=


(Matthew McDermott) #3

@Jim Thanks, I really did try! Also, I had not seen the public repo. Good stuff in there.