mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-25 05:04:09 +00:00
Compare commits
7 Commits
MSA-1809-1
...
MSA-1814-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb4f13ad85 | ||
|
|
65ae2c0ddf | ||
|
|
7e806275ce | ||
|
|
1ed57aab45 | ||
|
|
4eea7ff90f | ||
|
|
b2264538c9 | ||
|
|
f45ab69045 |
@@ -108,8 +108,8 @@ def parse(String description) {
|
|||||||
}
|
}
|
||||||
} else if (descMap.clusterInt == 0x0406 && descMap.attrInt == 0x0000) {
|
} else if (descMap.clusterInt == 0x0406 && descMap.attrInt == 0x0000) {
|
||||||
def value = descMap.value.endsWith("01") ? "active" : "inactive"
|
def value = descMap.value.endsWith("01") ? "active" : "inactive"
|
||||||
log.warn "Doing a read attr motion event"
|
log.debug "Doing a read attr motion event"
|
||||||
resultMap = getMotionResult(value)
|
map = getMotionResult(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,103 +0,0 @@
|
|||||||
/**
|
|
||||||
* Curb Control
|
|
||||||
*
|
|
||||||
* Copyright 2016 Savanni D'Gerinel
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
definition(
|
|
||||||
name: "Curb Control",
|
|
||||||
namespace: "curb-v2",
|
|
||||||
author: "Savanni D'Gerinel",
|
|
||||||
description: "Control point for Curb/SmartThings integration",
|
|
||||||
category: "Green Living",
|
|
||||||
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 Endpoint to Control These Things...") {
|
|
||||||
input "switches", "capability.switch", title: "Which Switches?", multiple: true, required: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mappings {
|
|
||||||
|
|
||||||
path("/switches") {
|
|
||||||
action: [
|
|
||||||
GET: "listSwitches"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/switches/:id") {
|
|
||||||
action: [
|
|
||||||
GET: "showSwitch"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/switches/:id/:command") {
|
|
||||||
action: [
|
|
||||||
PUT: "updateSwitch"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def installed() {}
|
|
||||||
|
|
||||||
def updated() {}
|
|
||||||
|
|
||||||
|
|
||||||
//switches
|
|
||||||
def listSwitches() {
|
|
||||||
switches.collect{device(it,"switch")}
|
|
||||||
}
|
|
||||||
|
|
||||||
def showSwitch() {
|
|
||||||
show(switches, "switch")
|
|
||||||
}
|
|
||||||
void updateSwitch() {
|
|
||||||
update(switches)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def deviceHandler(evt) {}
|
|
||||||
|
|
||||||
private void update(devices) {
|
|
||||||
log.debug "update, request: params: ${params}, devices: $devices.id"
|
|
||||||
|
|
||||||
|
|
||||||
//def command = request.JSON?.command
|
|
||||||
def command = params.command
|
|
||||||
//let's create a toggle option here
|
|
||||||
if (command)
|
|
||||||
{
|
|
||||||
def device = devices.find { it.id == params.id }
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else {
|
|
||||||
if(command == "toggle")
|
|
||||||
{
|
|
||||||
if(device.currentValue('switch') == "on")
|
|
||||||
device.off();
|
|
||||||
else
|
|
||||||
device.on();;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private show(devices, type) {
|
|
||||||
def device = devices.find { it.id == params.id }
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
def attributeName = type == "motionSensor" ? "motion" : type
|
|
||||||
def s = device.currentState(attributeName)
|
|
||||||
[id: device.id, label: device.displayName, value: s?.value, unitTime: s?.date?.time, type: type]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private device(it, type) {
|
|
||||||
it ? [id: it.id, label: it.label, type: type] : null
|
|
||||||
}
|
|
||||||
@@ -52,4 +52,4 @@ def changedLocationMode(evt) {
|
|||||||
def appTouch(evt) {
|
def appTouch(evt) {
|
||||||
log.debug "appTouch: $evt"
|
log.debug "appTouch: $evt"
|
||||||
switches?.on()
|
switches?.on()
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user