So I’m simultaneously learning about Groovy and the SmartThings API (I’m an Asp.Net / c# developer). I’m playing with making a Web Service SmartApp and an ASP.Net web site to consume and control it. I’ve implemented and understand the Web Service sample (article 1) and consuming REST and using OAuth (article 2) is old hat. Now I’m looking to extend my Web Service SmartApp beyond the sample “list” and “update” switches methods. While I keep looking at Groovy language specifications I’m wondering if anyone can get me a jump start on a couple ST concepts:
-
I understand devices are accessed by capability, but there’s duplication. If I have a dimmer and want to authorize access to it through my service it seems to be available in both
capability.switch
andcapability.switchLevel
. Do I even need to authorizecapability.switchLevel
because I can test for that capability on the device later? -
More of a Groovy quick start question (related to Q1) - how would I modify the sample code below if I wanted to include an array of capabilities from
device.capabilities
for a switch (to see if its a dimmer, or I’m assuming other types of devices support this base capability)?def listSwitches() {
def resp = []
switches.each {
resp << [name: it.displayName, id: it.id, value: it.currentValue(“switch”)]
}
return resp
} -
In a community topic I read somewhere that the ActiON Dashboard was a good example to look at a ST Web Service app, but it looks like that is now SmartTiles and the source is no longer available. Does anyone have an example of a more feature rich ST Web Service than the docs walkthrough they could point me to? Or is there a lingering copy of the ActiON WS code out there somewhere in the universe?