Restfull api get list switchLevel not found devices?


(Binh Nguyen) #1

please help.
how to get list switchLevel and create RestFull api to setLevel
here my code :

input "switchlevels", type: "capability.switchLevel", title: "Which Switchlevels?", multiple: true ,required: true

// then map

// switchLevel

path("/switchlevels") {
action: [
GET: "listSwitchlevels"
]
}
path("/switchlevels/:id") {
action: [
GET: "showSwitchlevel"
]
}
path("/switchlevels/:id/:lightLevel") {
action: [
GET: "updateSwitchlevel"
]
}

//then codefunction

//switchesLevel

def listSwitchlevels() {

log.debug " List listSwitchlevels params: ${params}"

switchlevels.collect{device(it,"switchLevel")}
}

def showSwitchlevel() {
show(switchlevels, "switchLevel")
}
void updateSwitchlevel() {
setLevelSwich(switchlevels)
}

so, I always get Error :
Smartthings not found devices type.
but I have an device type : Dimmer switch in link : https://shop.smartthings.com/#/products/ge-z-wave-wireless-lighting-control-lamp-module-dimmer


(Huntb) #2

Device type does not refer to the physical device. It refers to the actual device type set under the “My Devices” tab in the ST API. What do you have this set as?


(Binh Nguyen) #3

thank for your reply.
with this code , now it run ok. I dont known why ? because I did’nt change the code. but I got another problems here