Hopefully someone can help me. I have a list of devices in a smart app. The app acts as a web service endpoint. When I receive a call in the app, I want to send a command to a specific device. The device is identified by a preference - defined in the device handler.
I am relatively new to SmartThings and feel like I am missing something obvious.
If by “I have a list of devices in a smart app” you mean that you have used an “input” preference and allowed the user to choose a list of devices, then you will have to search that list to match the device with some data from the endpoint call. For example, if the endpoint uses the device display name, you would do something similar to:
Thanks all - let me explain the use case a bit more.
I wanted to explore a local integration with lightwaverf. I have created a virtual switch device handler. Each switch has a number preference that describes the room and device is.
On my local service I have a java process that listens to UDP broadcasts from the lightwaverf wifi link. This in turn calls a smartapp web end point. The smartapp has a user specified list of all the virtual switches.
This all works - however I need to select the switch (by the device preference room and device id) that corresponds to the web service call.
I can’t for the life of me find out how to access the device preference from the smartapp web service call.