mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-16 21:03:28 +00:00
Compare commits
1 Commits
MSA-2155-2
...
production
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f09d0aa987 |
@@ -18,7 +18,6 @@ metadata {
|
|||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Smoke Detector" //attributes: smoke ("detected","clear","tested")
|
capability "Smoke Detector" //attributes: smoke ("detected","clear","tested")
|
||||||
capability "Temperature Measurement" //attributes: temperature
|
capability "Temperature Measurement" //attributes: temperature
|
||||||
capability "Health Check"
|
|
||||||
attribute "tamper", "enum", ["detected", "clear"]
|
attribute "tamper", "enum", ["detected", "clear"]
|
||||||
attribute "heatAlarm", "enum", ["overheat detected", "clear", "rapid temperature rise", "underheat detected"]
|
attribute "heatAlarm", "enum", ["overheat detected", "clear", "rapid temperature rise", "underheat detected"]
|
||||||
fingerprint deviceId: "0x0701", inClusters: "0x5E, 0x86, 0x72, 0x5A, 0x59, 0x85, 0x73, 0x84, 0x80, 0x71, 0x56, 0x70, 0x31, 0x8E, 0x22, 0x9C, 0x98, 0x7A", outClusters: "0x20, 0x8B"
|
fingerprint deviceId: "0x0701", inClusters: "0x5E, 0x86, 0x72, 0x5A, 0x59, 0x85, 0x73, 0x84, 0x80, 0x71, 0x56, 0x70, 0x31, 0x8E, 0x22, 0x9C, 0x98, 0x7A", outClusters: "0x20, 0x8B"
|
||||||
@@ -340,8 +339,6 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
// Device wakes up every 4 hours, this interval allows us to miss one wakeup notification before marking offline
|
|
||||||
sendEvent(name: "checkInterval", value: 8 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
|
||||||
// This sensor joins as a secure device if you tripple-click the button to include it
|
// This sensor joins as a secure device if you tripple-click the button to include it
|
||||||
log.debug "configure() >> isSecured() : ${isSecured()}"
|
log.debug "configure() >> isSecured() : ${isSecured()}"
|
||||||
if (!isSecured()) {
|
if (!isSecured()) {
|
||||||
|
|||||||
@@ -1,203 +0,0 @@
|
|||||||
import grails.converters.JSON
|
|
||||||
|
|
||||||
/**
|
|
||||||
* JSON API Access App
|
|
||||||
*/
|
|
||||||
|
|
||||||
definition(
|
|
||||||
name: "Quantum",
|
|
||||||
namespace: "Quantum",
|
|
||||||
author: "Qblinks",
|
|
||||||
description: "Quantum is an iPaaS (integration platform as a service) designed for your Smart Home products. With Quantum, you can easily integrate your product with different 3rd party smart home products around the world through a single API call. Smart home features of Qblinks Inc. products are powered by Quantum.",
|
|
||||||
category: "Convenience",
|
|
||||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
|
|
||||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
|
|
||||||
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
|
|
||||||
oauth: true
|
|
||||||
)
|
|
||||||
|
|
||||||
preferences {
|
|
||||||
section("Allow these things to be exposed via JSON...") {
|
|
||||||
input "switches", "capability.colorControl", title: "Switches", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
input "outlets", "capability.outlet", title: "Outlets", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mappings {
|
|
||||||
path("/switchDiscovery") {
|
|
||||||
action: [
|
|
||||||
GET: "listSwitches"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/outletDiscovery") {
|
|
||||||
action: [
|
|
||||||
GET: "listOutlets"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/switchAction/:id/:command/:value") {
|
|
||||||
action: [
|
|
||||||
PUT: "actionSwitches"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/outletAction/:id/:command") {
|
|
||||||
action: [
|
|
||||||
PUT: "actionOutlets"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/switchStat/:id") {
|
|
||||||
action: [
|
|
||||||
GET: "statSwitches"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/outletStat/:id") {
|
|
||||||
action: [
|
|
||||||
GET: "statOutlets"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def listSwitches() {
|
|
||||||
[ switches: switches.collect{device(it, "switch")} ]
|
|
||||||
}
|
|
||||||
|
|
||||||
def listOutlets() {
|
|
||||||
[ outlets: outlets.collect{device(it, "outlet")} ]
|
|
||||||
}
|
|
||||||
|
|
||||||
void actionSwitches() {
|
|
||||||
def device = switches.find { it.id == params.id }
|
|
||||||
def command = params.command
|
|
||||||
|
|
||||||
switch(command) {
|
|
||||||
case "on":
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else {
|
|
||||||
device.on()
|
|
||||||
//def newValue = [level: body.level as Integer ?: 100]
|
|
||||||
//device.setColor(newValue)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "off":
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else {
|
|
||||||
device.off()
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "bri":
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else {
|
|
||||||
def newValue = [level: params.value as Integer ?: 0]
|
|
||||||
device.setColor(newValue)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "sat":
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else {
|
|
||||||
def newValue = [saturation: params.value as Integer ?: 0]
|
|
||||||
device.setColor(newValue)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "hue":
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else {
|
|
||||||
def newValue = [hue: params.value as Integer ?: 0]
|
|
||||||
device.setColor(newValue)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "allOn":
|
|
||||||
switches.on()
|
|
||||||
break
|
|
||||||
case "allOff":
|
|
||||||
switches.off()
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
httpError(404, "$command is not a valid command for all outlets specified")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def statSwitches() {
|
|
||||||
show(switches, "switch")
|
|
||||||
}
|
|
||||||
|
|
||||||
void actionOutlets() {
|
|
||||||
def device = outlets.find { it.id == params.id }
|
|
||||||
def command = params.command
|
|
||||||
|
|
||||||
switch(command) {
|
|
||||||
case "on":
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else {
|
|
||||||
device.on()
|
|
||||||
result:true
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "off":
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else {
|
|
||||||
device.off()
|
|
||||||
result:true
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "onoff":
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else {
|
|
||||||
device.on()
|
|
||||||
device.off()
|
|
||||||
result:true
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "allOn":
|
|
||||||
outlets.on()
|
|
||||||
break
|
|
||||||
case "allOff":
|
|
||||||
outlets.off()
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
httpError(404, "$command is not a valid command for all outlets specified")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def statOutlets() {
|
|
||||||
show(outlets, "outlet")
|
|
||||||
}
|
|
||||||
|
|
||||||
private show(devices, type) {
|
|
||||||
def device = devices.find { it.id == params.id }
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
def device_state = [ label: device.name, type: type, id: device.id, network: device.getDeviceNetworkId() ]
|
|
||||||
|
|
||||||
for (attribute in device.supportedAttributes) {
|
|
||||||
device_state."${attribute}" = device.currentValue("${attribute}")
|
|
||||||
}
|
|
||||||
|
|
||||||
device_state ? device_state : null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private device(it, type) {
|
|
||||||
def device_state = [ label: it.name, type: type, id: it.id, network: it.getDeviceNetworkId()]
|
|
||||||
|
|
||||||
|
|
||||||
for (attribute in it.supportedAttributes) {
|
|
||||||
device_state."${attribute}" = it.currentValue("${attribute}")
|
|
||||||
}
|
|
||||||
|
|
||||||
device_state ? device_state : null
|
|
||||||
}
|
|
||||||
|
|
||||||
def installed() {
|
|
||||||
}
|
|
||||||
|
|
||||||
def updated() {
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user