11 description: "This SmartApp allows you to interact with the switches in your physical graph through Curb.",
12 category: "Convenience",
13 iconUrl: "http://energycurb.com/images/logo.png",
14 iconX2Url: "http://energycurb.com/images/logo.png",
15 oauth: [displayName: "SmartThings Curb Control", displayLink: "energycurb.com"]
19 section("Allow Curb to Control These Things...") {
20 input "switches", "capability.switch", title: "Which Switches?", multiple: true, required: false
36 path("/switches/:id") {
53 switches.collect { device(it,"switch") }
55 void updateSwitches() {
59 show(switches, "switch")
65 private void updateAll(devices) {
66 def command = request.JSON?.command
76 httpError(403, "Access denied. This command is not supported by current capability.")
81 private void update(devices) {
82 log.debug "update, request: ${request.JSON}, params: ${params}, devices: $devices.id"
83 def command = request.JSON?.command
85 def device = devices.find { it.id == params.id }
87 httpError(404, "Device not found")
97 httpError(403, "Access denied. This command is not supported by current capability.")
103 private show(devices, name) {
104 def d = devices.find { it.id == params.id }
106 httpError(404, "Device not found")
113 private device(it, name){
115 def s = it.currentState(name)
116 [id: it.id, label: it.displayName, name: it.displayName, state: s]