mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-17 13:10:52 +00:00
Compare commits
19 Commits
DVCSMP-180
...
MSA-1372-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef29820fa1 | ||
|
|
fd47bcb8a8 | ||
|
|
972599b1b5 | ||
|
|
f5d3cca6a0 | ||
|
|
9b285ec93b | ||
|
|
777f8f7e20 | ||
|
|
eac48382e8 | ||
|
|
9f09a4b0b2 | ||
|
|
3c47fe7b60 | ||
|
|
45a0822e9b | ||
|
|
8cc87f3858 | ||
|
|
e818695947 | ||
|
|
bbba20288e | ||
|
|
ff9dd3f6e2 | ||
|
|
a94a62d34c | ||
|
|
e861d3c256 | ||
|
|
7adff88d0f | ||
|
|
8d8b039dda | ||
|
|
49d293e749 |
@@ -29,6 +29,7 @@ metadata {
|
|||||||
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x86,0x72,0x98", outClusters: "0x5A,0x82"
|
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x86,0x72,0x98", outClusters: "0x5A,0x82"
|
||||||
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x80,0x71,0x85,0x70,0x72,0x86,0x30,0x31,0x84,0x59,0x73,0x5A,0x8F,0x98,0x7A", outClusters:"0x20" // Philio multi+
|
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x80,0x71,0x85,0x70,0x72,0x86,0x30,0x31,0x84,0x59,0x73,0x5A,0x8F,0x98,0x7A", outClusters:"0x20" // Philio multi+
|
||||||
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x72,0x5A,0x80,0x73,0x86,0x84,0x85,0x59,0x71,0x70,0x7A,0x98" // Vision door/window
|
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x72,0x5A,0x80,0x73,0x86,0x84,0x85,0x59,0x71,0x70,0x7A,0x98" // Vision door/window
|
||||||
|
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x98,0x86,0x72,0x5A,0x85,0x59,0x73,0x80,0x71,0x31,0x70,0x84,0x7A" // Vision Motion
|
||||||
}
|
}
|
||||||
|
|
||||||
// simulator metadata
|
// simulator metadata
|
||||||
@@ -263,5 +264,9 @@ def retypeBasedOnMSR() {
|
|||||||
log.debug "Changing device type to Door / Window Sensor Plus (SG)"
|
log.debug "Changing device type to Door / Window Sensor Plus (SG)"
|
||||||
setDeviceType("Door / Window Sensor Plus (SG)")
|
setDeviceType("Door / Window Sensor Plus (SG)")
|
||||||
break
|
break
|
||||||
|
case "0109-2002-0205": // Vision Motion
|
||||||
|
log.debug "Changing device type to Vision Motion Sensor Plus (SG)"
|
||||||
|
setDeviceType("Vision Motion Sensor Plus (SG)")
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,17 +24,24 @@ definition(
|
|||||||
iconX3Url: "http://www.gidjit.com/appicon@3x.png",
|
iconX3Url: "http://www.gidjit.com/appicon@3x.png",
|
||||||
oauth: [displayName: "Gidjit", displayLink: "www.gidjit.com"])
|
oauth: [displayName: "Gidjit", displayLink: "www.gidjit.com"])
|
||||||
|
|
||||||
|
preferences(oauthPage: "deviceAuthorization") {
|
||||||
|
// deviceAuthorization page is simply the devices to authorize
|
||||||
|
page(name: "deviceAuthorization", title: "Device Authorization", nextPage: "instructionPage",
|
||||||
|
install: false, uninstall: true) {
|
||||||
|
section ("Allow Gidjit to have access, thereby allowing you to quickly control and monitor your following devices. Privacy Policy can be found at http://priv.gidjit.com/privacy.html") {
|
||||||
|
input "switches", "capability.switch", title: "Control/Monitor your switches", multiple: true, required: false
|
||||||
|
input "thermostats", "capability.thermostat", title: "Control/Monitor your thermostats", multiple: true, required: false
|
||||||
|
input "windowShades", "capability.windowShade", title: "Control/Monitor your window shades", multiple: true, required: false //windowShade
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
preferences {
|
page(name: "instructionPage", title: "Device Discovery", install: true) {
|
||||||
section ("Allow Gidjit to have access, there by allowing you to quickly control and monitor the following devices") {
|
section() {
|
||||||
input "switches", "capability.switch", title: "Control/Monitor your switches", multiple: true, required: false
|
paragraph "Now the process is complete return to the Devices section of the Detected Screen. From there and you can add actions to each of your device panels, including launching SmartThings routines."
|
||||||
input "thermostats", "capability.thermostat", title: "Control/Monitor your thermostats", multiple: true, required: false
|
}
|
||||||
input "windowShades", "capability.windowShade", title: "Control/Monitor your window shades", multiple: true, required: false //windowShade
|
}
|
||||||
//input "bulbs", "capability.colorControl", title: "Control your lights", multiple: true, required: false //windowShade
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mappings {
|
mappings {
|
||||||
path("/structureinfo") {
|
path("/structureinfo") {
|
||||||
action: [
|
action: [
|
||||||
|
|||||||
@@ -337,10 +337,10 @@ def initialize() {
|
|||||||
|
|
||||||
settings.devices.each {
|
settings.devices.each {
|
||||||
def deviceId = it
|
def deviceId = it
|
||||||
def detail = state.deviceDetail[deviceId]
|
def detail = state?.deviceDetail[deviceId]
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch(detail.type) {
|
switch(detail?.type) {
|
||||||
case 'NAMain':
|
case 'NAMain':
|
||||||
log.debug "Base station"
|
log.debug "Base station"
|
||||||
createChildDevice("Netatmo Basestation", deviceId, "${detail.type}.${deviceId}", detail.module_name)
|
createChildDevice("Netatmo Basestation", deviceId, "${detail.type}.${deviceId}", detail.module_name)
|
||||||
@@ -487,12 +487,12 @@ def poll() {
|
|||||||
log.debug "State: ${state.deviceState}"
|
log.debug "State: ${state.deviceState}"
|
||||||
|
|
||||||
settings.devices.each { deviceId ->
|
settings.devices.each { deviceId ->
|
||||||
def detail = state.deviceDetail[deviceId]
|
def detail = state?.deviceDetail[deviceId]
|
||||||
def data = state.deviceState[deviceId]
|
def data = state?.deviceState[deviceId]
|
||||||
def child = children.find { it.deviceNetworkId == deviceId }
|
def child = children?.find { it.deviceNetworkId == deviceId }
|
||||||
|
|
||||||
log.debug "Update: $child";
|
log.debug "Update: $child";
|
||||||
switch(detail.type) {
|
switch(detail?.type) {
|
||||||
case 'NAMain':
|
case 'NAMain':
|
||||||
log.debug "Updating NAMain $data"
|
log.debug "Updating NAMain $data"
|
||||||
child?.sendEvent(name: 'temperature', value: cToPref(data['Temperature']) as float, unit: getTemperatureScale())
|
child?.sendEvent(name: 'temperature', value: cToPref(data['Temperature']) as float, unit: getTemperatureScale())
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ preferences {
|
|||||||
page(name: "completionPage")
|
page(name: "completionPage")
|
||||||
page(name: "numbersPage")
|
page(name: "numbersPage")
|
||||||
page(name: "controllerExplanationPage")
|
page(name: "controllerExplanationPage")
|
||||||
|
page(name: "unsupportedDevicesPage")
|
||||||
}
|
}
|
||||||
|
|
||||||
def rootPage() {
|
def rootPage() {
|
||||||
@@ -47,6 +48,9 @@ def rootPage() {
|
|||||||
section("What to dim") {
|
section("What to dim") {
|
||||||
input(name: "dimmers", type: "capability.switchLevel", title: "Dimmers", description: null, multiple: true, required: true, submitOnChange: true)
|
input(name: "dimmers", type: "capability.switchLevel", title: "Dimmers", description: null, multiple: true, required: true, submitOnChange: true)
|
||||||
if (dimmers) {
|
if (dimmers) {
|
||||||
|
if (dimmersContainUnsupportedDevices()) {
|
||||||
|
href(name: "toUnsupportedDevicesPage", page: "unsupportedDevicesPage", title: "Some of your selected dimmers don't seem to be supported", description: "Tap here to fix it", required: true)
|
||||||
|
}
|
||||||
href(name: "toNumbersPage", page: "numbersPage", title: "Duration & Direction", description: numbersPageHrefDescription(), state: "complete")
|
href(name: "toNumbersPage", page: "numbersPage", title: "Duration & Direction", description: numbersPageHrefDescription(), state: "complete")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,6 +75,31 @@ def rootPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def unsupportedDevicesPage() {
|
||||||
|
|
||||||
|
def unsupportedDimmers = dimmers.findAll { !hasSetLevelCommand(it) }
|
||||||
|
|
||||||
|
dynamicPage(name: "unsupportedDevicesPage") {
|
||||||
|
if (unsupportedDimmers) {
|
||||||
|
section("These devices do not support the setLevel command") {
|
||||||
|
unsupportedDimmers.each {
|
||||||
|
paragraph deviceLabel(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
section {
|
||||||
|
input(name: "dimmers", type: "capability.sensor", title: "Please remove the above devices from this list.", submitOnChange: true, multiple: true)
|
||||||
|
}
|
||||||
|
section {
|
||||||
|
paragraph "If you think there is a mistake here, please contact support."
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
section {
|
||||||
|
paragraph "You're all set. You can hit the back button, now. Thanks for cleaning up your settings :)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def controllerExplanationPage() {
|
def controllerExplanationPage() {
|
||||||
dynamicPage(name: "controllerExplanationPage", title: "How To Control Gentle Wake Up") {
|
dynamicPage(name: "controllerExplanationPage", title: "How To Control Gentle Wake Up") {
|
||||||
|
|
||||||
@@ -528,14 +557,16 @@ def updateDimmers(percentComplete) {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
def shouldChangeColors = (colorize && colorize != "false")
|
def shouldChangeColors = (colorize && colorize != "false")
|
||||||
def canChangeColors = hasSetColorCommand(dimmer)
|
|
||||||
|
|
||||||
log.debug "Setting ${deviceLabel(dimmer)} to ${nextLevel}"
|
if (shouldChangeColors && hasSetColorCommand(dimmer)) {
|
||||||
|
def hue = getHue(dimmer, nextLevel)
|
||||||
if (shouldChangeColors && canChangeColors) {
|
log.debug "Setting ${deviceLabel(dimmer)} level to ${nextLevel} and hue to ${hue}"
|
||||||
dimmer.setColor([hue: getHue(dimmer, nextLevel), saturation: 100, level: nextLevel])
|
dimmer.setColor([hue: hue, saturation: 100, level: nextLevel])
|
||||||
} else {
|
} else if (hasSetLevelCommand(dimmer)) {
|
||||||
|
log.debug "Setting ${deviceLabel(dimmer)} level to ${nextLevel}"
|
||||||
dimmer.setLevel(nextLevel)
|
dimmer.setLevel(nextLevel)
|
||||||
|
} else {
|
||||||
|
log.warn "${deviceLabel(dimmer)} does not have setColor or setLevel commands."
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -817,24 +848,21 @@ private getRedHue(level) {
|
|||||||
if (level >= 96) return 17
|
if (level >= 96) return 17
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private dimmersContainUnsupportedDevices() {
|
||||||
|
def found = dimmers.find { hasSetLevelCommand(it) == false }
|
||||||
|
return found != null
|
||||||
|
}
|
||||||
|
|
||||||
private hasSetLevelCommand(device) {
|
private hasSetLevelCommand(device) {
|
||||||
def isDimmer = false
|
return hasCommand(device, "setLevel")
|
||||||
device.supportedCommands.each {
|
|
||||||
if (it.name.contains("setLevel")) {
|
|
||||||
isDimmer = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return isDimmer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private hasSetColorCommand(device) {
|
private hasSetColorCommand(device) {
|
||||||
def hasColor = false
|
return hasCommand(device, "setColor")
|
||||||
device.supportedCommands.each {
|
}
|
||||||
if (it.name.contains("setColor")) {
|
|
||||||
hasColor = true
|
private hasCommand(device, String command) {
|
||||||
}
|
return (device.supportedCommands.find { it.name == command } != null)
|
||||||
}
|
|
||||||
return hasColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private dimmersWithSetColorCommand() {
|
private dimmersWithSetColorCommand() {
|
||||||
@@ -1073,4 +1101,4 @@ def hasStartLevel() {
|
|||||||
|
|
||||||
def hasEndLevel() {
|
def hasEndLevel() {
|
||||||
return (endLevel != null && endLevel != "")
|
return (endLevel != null && endLevel != "")
|
||||||
}
|
}
|
||||||
@@ -658,29 +658,73 @@ def updateDevice() {
|
|||||||
def data = request.JSON
|
def data = request.JSON
|
||||||
def command = data.command
|
def command = data.command
|
||||||
def arguments = data.arguments
|
def arguments = data.arguments
|
||||||
|
|
||||||
log.debug "updateDevice, params: ${params}, request: ${data}"
|
log.debug "updateDevice, params: ${params}, request: ${data}"
|
||||||
if (!command) {
|
if (!command) {
|
||||||
render status: 400, data: '{"msg": "command is required"}'
|
render status: 400, data: '{"msg": "command is required"}'
|
||||||
} else {
|
} else {
|
||||||
def device = allDevices.find { it.id == params.id }
|
def device = allDevices.find { it.id == params.id }
|
||||||
if (device) {
|
if (device) {
|
||||||
if (device.hasCommand("$command")) {
|
if (validateCommand(device, command)) {
|
||||||
if (arguments) {
|
if (arguments) {
|
||||||
device."$command"(*arguments)
|
device."$command"(*arguments)
|
||||||
} else {
|
} else {
|
||||||
device."$command"()
|
device."$command"()
|
||||||
}
|
}
|
||||||
render status: 204, data: "{}"
|
render status: 204, data: "{}"
|
||||||
} else {
|
} else {
|
||||||
render status: 404, data: '{"msg": "Command not supported by this Device"}'
|
render status: 403, data: '{"msg": "Access denied. This command is not supported by current capability."}'
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
render status: 404, data: '{"msg": "Device not found"}'
|
render status: 404, data: '{"msg": "Device not found"}'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validating the command passed by the user based on capability.
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
def validateCommand(device, command) {
|
||||||
|
def capabilityCommands = getDeviceCapabilityCommands(device.capabilities)
|
||||||
|
def currentDeviceCapability = getCapabilityName(device)
|
||||||
|
if (currentDeviceCapability != "" && capabilityCommands[currentDeviceCapability]) {
|
||||||
|
return command in capabilityCommands[currentDeviceCapability] ? true : false
|
||||||
|
} else {
|
||||||
|
// Handling other device types here, which don't accept commands
|
||||||
|
httpError(400, "Bad request.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Need to get the attribute name to do the lookup. Only
|
||||||
|
* doing it for the device types which accept commands
|
||||||
|
* @return attribute name of the device type
|
||||||
|
*/
|
||||||
|
def getCapabilityName(device) {
|
||||||
|
def capName = ""
|
||||||
|
if (switches.find{it.id == device.id})
|
||||||
|
capName = "Switch"
|
||||||
|
else if (alarms.find{it.id == device.id})
|
||||||
|
capName = "Alarm"
|
||||||
|
else if (locks.find{it.id == device.id})
|
||||||
|
capName = "Lock"
|
||||||
|
log.trace "Device: $device - Capability Name: $capName"
|
||||||
|
return capName
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructing the map over here of
|
||||||
|
* supported commands by device capability
|
||||||
|
* @return a map of device capability -> supported commands
|
||||||
|
*/
|
||||||
|
def getDeviceCapabilityCommands(deviceCapabilities) {
|
||||||
|
def map = [:]
|
||||||
|
deviceCapabilities.collect {
|
||||||
|
map[it.name] = it.commands.collect{ it.name.toString() }
|
||||||
|
}
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
|
||||||
def listSubscriptions() {
|
def listSubscriptions() {
|
||||||
log.debug "listSubscriptions()"
|
log.debug "listSubscriptions()"
|
||||||
app.subscriptions?.findAll { it.device?.device && it.device.id }?.collect {
|
app.subscriptions?.findAll { it.device?.device && it.device.id }?.collect {
|
||||||
@@ -780,17 +824,51 @@ def deviceHandler(evt) {
|
|||||||
|
|
||||||
def sendToHarmony(evt, String callbackUrl) {
|
def sendToHarmony(evt, String callbackUrl) {
|
||||||
def callback = new URI(callbackUrl)
|
def callback = new URI(callbackUrl)
|
||||||
def host = callback.port != -1 ? "${callback.host}:${callback.port}" : callback.host
|
if(isIP(callback.host)){
|
||||||
def path = callback.query ? "${callback.path}?${callback.query}".toString() : callback.path
|
def host = callback.port != -1 ? "${callback.host}:${callback.port}" : callback.host
|
||||||
sendHubCommand(new physicalgraph.device.HubAction(
|
def path = callback.query ? "${callback.path}?${callback.query}".toString() : callback.path
|
||||||
method: "POST",
|
sendHubCommand(new physicalgraph.device.HubAction(
|
||||||
path: path,
|
method: "POST",
|
||||||
headers: [
|
path: path,
|
||||||
"Host": host,
|
headers: [
|
||||||
"Content-Type": "application/json"
|
"Host": host,
|
||||||
],
|
"Content-Type": "application/json"
|
||||||
body: [evt: [deviceId: evt.deviceId, name: evt.name, value: evt.value]]
|
],
|
||||||
))
|
body: [evt: [deviceId: evt.deviceId, name: evt.name, value: evt.value]]
|
||||||
|
))
|
||||||
|
} else {
|
||||||
|
def params = [
|
||||||
|
uri: callbackUrl,
|
||||||
|
body: [evt: [deviceId: evt.deviceId, name: evt.name, value: evt.value]]
|
||||||
|
]
|
||||||
|
try {
|
||||||
|
log.debug "Sending data to Harmony Cloud: $params"
|
||||||
|
httpPostJson(params) { resp ->
|
||||||
|
log.debug "Harmony Cloud - Response: ${resp.status}"
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log.error "Harmony Cloud - Something went wrong: $e"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isIP(String str) {
|
||||||
|
try {
|
||||||
|
String[] parts = str.split("\\.");
|
||||||
|
if (parts.length != 4) return false;
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
int p
|
||||||
|
try {
|
||||||
|
p = Integer.parseInt(parts[i]);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (p > 255 || p < 0) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def listHubs() {
|
def listHubs() {
|
||||||
|
|||||||
@@ -92,22 +92,87 @@ void updateLock() {
|
|||||||
|
|
||||||
private void updateAll(devices) {
|
private void updateAll(devices) {
|
||||||
def command = request.JSON?.command
|
def command = request.JSON?.command
|
||||||
if (command) {
|
def type = params.param1
|
||||||
devices."$command"()
|
if (!devices) {
|
||||||
|
httpError(404, "Devices not found")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command){
|
||||||
|
devices.each { device ->
|
||||||
|
executeCommand(device, type, command)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update(devices) {
|
private void update(devices) {
|
||||||
log.debug "update, request: ${request.JSON}, params: ${params}, devices: $devices.id"
|
log.debug "update, request: ${request.JSON}, params: ${params}, devices: $devices.id"
|
||||||
def command = request.JSON?.command
|
def command = request.JSON?.command
|
||||||
if (command) {
|
def type = params.param1
|
||||||
def device = devices.find { it.id == params.id }
|
def device = devices?.find { it.id == params.id }
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
if (!device) {
|
||||||
} else {
|
httpError(404, "Device not found")
|
||||||
device."$command"()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command) {
|
||||||
|
executeCommand(device, type, command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validating the command passed by the user based on capability.
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
def validateCommand(device, deviceType, command) {
|
||||||
|
def capabilityCommands = getDeviceCapabilityCommands(device.capabilities)
|
||||||
|
def currentDeviceCapability = getCapabilityName(deviceType)
|
||||||
|
if (capabilityCommands[currentDeviceCapability]) {
|
||||||
|
return command in capabilityCommands[currentDeviceCapability] ? true : false
|
||||||
|
} else {
|
||||||
|
// Handling other device types here, which don't accept commands
|
||||||
|
httpError(400, "Bad request.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Need to get the attribute name to do the lookup. Only
|
||||||
|
* doing it for the device types which accept commands
|
||||||
|
* @return attribute name of the device type
|
||||||
|
*/
|
||||||
|
def getCapabilityName(type) {
|
||||||
|
switch(type) {
|
||||||
|
case "switches":
|
||||||
|
return "Switch"
|
||||||
|
case "locks":
|
||||||
|
return "Lock"
|
||||||
|
default:
|
||||||
|
return type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructing the map over here of
|
||||||
|
* supported commands by device capability
|
||||||
|
* @return a map of device capability -> supported commands
|
||||||
|
*/
|
||||||
|
def getDeviceCapabilityCommands(deviceCapabilities) {
|
||||||
|
def map = [:]
|
||||||
|
deviceCapabilities.collect {
|
||||||
|
map[it.name] = it.commands.collect{ it.name.toString() }
|
||||||
|
}
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates and executes the command
|
||||||
|
* on the device or devices
|
||||||
|
*/
|
||||||
|
def executeCommand(device, type, command) {
|
||||||
|
if (validateCommand(device, type, command)) {
|
||||||
|
device."$command"()
|
||||||
|
} else {
|
||||||
|
httpError(403, "Access denied. This command is not supported by current capability.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private show(devices, name) {
|
private show(devices, name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user