mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-20 05:10:51 +00:00
Compare commits
10 Commits
MSA-1577-2
...
PROD_2016.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5c21ef720 | ||
|
|
91a9856a32 | ||
|
|
a84ffdde91 | ||
|
|
3034cc8bcb | ||
|
|
6c84c052cb | ||
|
|
f017bff6ef | ||
|
|
65bb10d6d6 | ||
|
|
3f93de247b | ||
|
|
2b7af3ef8d | ||
|
|
cf9d123aa0 |
@@ -1,10 +1,10 @@
|
|||||||
# SmartThings Public GitHub Repo
|
# SmartThings Public Github Repo
|
||||||
|
|
||||||
An official list of SmartApps and Device Types from SmartThings.
|
An official list of SmartApps and Device Types from SmartThings.
|
||||||
|
|
||||||
Here are some links to help you get started coding right away:
|
Here are some links to help you get started coding right away:
|
||||||
|
|
||||||
* [GitHub-specific Documentation](http://docs.smartthings.com/en/latest/tools-and-ide/github-integration.html)
|
* [Github-specific Documentation](http://docs.smartthings.com/en/latest/tools-and-ide/github-integration.html)
|
||||||
* [Full Documentation](http://docs.smartthings.com)
|
* [Full Documentation](http://docs.smartthings.com)
|
||||||
* [IDE & Simulator](http://ide.smartthings.com)
|
* [IDE & Simulator](http://ide.smartthings.com)
|
||||||
* [Community Forums](http://community.smartthings.com)
|
* [Community Forums](http://community.smartthings.com)
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ metadata {
|
|||||||
definition (name: "Aeon Key Fob", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Aeon Key Fob", namespace: "smartthings", author: "SmartThings") {
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Button"
|
capability "Button"
|
||||||
capability "Holdable Button"
|
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
@@ -119,7 +118,3 @@ def configure() {
|
|||||||
log.debug("Sending configuration: $cmd")
|
log.debug("Sending configuration: $cmd")
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
def updated() {
|
|
||||||
sendEvent(name: "numberOfButtons", value: 4)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ metadata {
|
|||||||
definition (name: "Aeon Minimote", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Aeon Minimote", namespace: "smartthings", author: "SmartThings") {
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Button"
|
capability "Button"
|
||||||
capability "Holdable Button"
|
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
|
|
||||||
@@ -108,7 +107,3 @@ def configure() {
|
|||||||
log.debug("Sending configuration: $cmds")
|
log.debug("Sending configuration: $cmds")
|
||||||
return cmds
|
return cmds
|
||||||
}
|
}
|
||||||
|
|
||||||
def updated() {
|
|
||||||
sendEvent(name: "numberOfButtons", value: 4)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ metadata {
|
|||||||
capability "Switch"
|
capability "Switch"
|
||||||
capability "Switch Level"
|
capability "Switch Level"
|
||||||
capability "Button"
|
capability "Button"
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
|
|
||||||
//fingerprint deviceId: "0x1200", inClusters: "0x77 0x86 0x75 0x73 0x85 0x72 0xEF", outClusters: "0x26"
|
//fingerprint deviceId: "0x1200", inClusters: "0x77 0x86 0x75 0x73 0x85 0x72 0xEF", outClusters: "0x26"
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,3 @@ def updateState(String name, String value) {
|
|||||||
state[name] = value
|
state[name] = value
|
||||||
device.updateDataValue(name, value)
|
device.updateDataValue(name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
def updated() {
|
|
||||||
sendEvent(name: "numberOfButtons", value: 3)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -236,17 +236,17 @@ def refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void indicatorWhenOn() {
|
void indicatorWhenOn() {
|
||||||
sendEvent(name: "indicatorStatus", value: "when on", displayed: false)
|
sendEvent(name: "indicatorStatus", value: "when on", display: false)
|
||||||
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 3, size: 1).format()))
|
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 3, size: 1).format()))
|
||||||
}
|
}
|
||||||
|
|
||||||
void indicatorWhenOff() {
|
void indicatorWhenOff() {
|
||||||
sendEvent(name: "indicatorStatus", value: "when off", displayed: false)
|
sendEvent(name: "indicatorStatus", value: "when off", display: false)
|
||||||
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 3, size: 1).format()))
|
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 3, size: 1).format()))
|
||||||
}
|
}
|
||||||
|
|
||||||
void indicatorNever() {
|
void indicatorNever() {
|
||||||
sendEvent(name: "indicatorStatus", value: "never", displayed: false)
|
sendEvent(name: "indicatorStatus", value: "never", display: false)
|
||||||
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [2], parameterNumber: 3, size: 1).format()))
|
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [2], parameterNumber: 3, size: 1).format()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ metadata {
|
|||||||
void installed() {
|
void installed() {
|
||||||
// The device refreshes every 5 minutes by default so if we miss 2 refreshes we can consider it offline
|
// The device refreshes every 5 minutes by default so if we miss 2 refreshes we can consider it offline
|
||||||
// Using 12 minutes because in testing, device health team found that there could be "jitter"
|
// Using 12 minutes because in testing, device health team found that there could be "jitter"
|
||||||
sendEvent(name: "checkInterval", value: 60 * 12, data: [protocol: "cloud", hubHardwareId: device.hub.hardwareID], displayed: false)
|
sendEvent(name: "checkInterval", value: 60 * 12, data: [protocol: "cloud"], displayed: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Device Watch will ping the device to proactively determine if the device has gone offline
|
// Device Watch will ping the device to proactively determine if the device has gone offline
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ def zwaveEvent(physicalgraph.zwave.commands.configurationv1.ConfigurationReport
|
|||||||
def value = "when off"
|
def value = "when off"
|
||||||
if (cmd.configurationValue[0] == 1) {value = "when on"}
|
if (cmd.configurationValue[0] == 1) {value = "when on"}
|
||||||
if (cmd.configurationValue[0] == 2) {value = "never"}
|
if (cmd.configurationValue[0] == 2) {value = "never"}
|
||||||
[name: "indicatorStatus", value: value, displayed: false]
|
[name: "indicatorStatus", value: value, display: false]
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
def createEvent(physicalgraph.zwave.Command cmd, Map map) {
|
def createEvent(physicalgraph.zwave.Command cmd, Map map) {
|
||||||
@@ -829,7 +829,7 @@ def toggleTiles(color) {
|
|||||||
state.colorTiles.each({
|
state.colorTiles.each({
|
||||||
if ( it == color ) {
|
if ( it == color ) {
|
||||||
log.debug "Turning ${it} on"
|
log.debug "Turning ${it} on"
|
||||||
cmds << sendEvent(name: it, value: "on${it}", displayed: True, descriptionText: "${device.displayName} ${color} is 'ON'", isStateChange: true)
|
cmds << sendEvent(name: it, value: "on${it}", display: True, descriptionText: "${device.displayName} ${color} is 'ON'", isStateChange: true)
|
||||||
} else {
|
} else {
|
||||||
//log.debug "Turning ${it} off"
|
//log.debug "Turning ${it} off"
|
||||||
cmds << sendEvent(name: it, value: "off${it}", displayed: false)
|
cmds << sendEvent(name: it, value: "off${it}", displayed: false)
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ def parse(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def push() {
|
def push() {
|
||||||
sendEvent(name: "switch", value: "on", isStateChange: true, displayed: false)
|
sendEvent(name: "switch", value: "on", isStateChange: true, display: false)
|
||||||
sendEvent(name: "switch", value: "off", isStateChange: true, displayed: false)
|
sendEvent(name: "switch", value: "off", isStateChange: true, display: false)
|
||||||
sendEvent(name: "momentary", value: "pushed", isStateChange: true)
|
sendEvent(name: "momentary", value: "pushed", isStateChange: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ def parse(String description) {
|
|||||||
|
|
||||||
def event = [:]
|
def event = [:]
|
||||||
def finalResult = isKnownDescription(description)
|
def finalResult = isKnownDescription(description)
|
||||||
if (finalResult != "false") {
|
if (finalResult) {
|
||||||
log.info finalResult
|
log.info finalResult
|
||||||
if (finalResult.type == "update") {
|
if (finalResult.type == "update") {
|
||||||
log.info "$device updates: ${finalResult.value}"
|
log.info "$device updates: ${finalResult.value}"
|
||||||
@@ -212,13 +212,16 @@ def isKnownDescription(description) {
|
|||||||
else if (descMap.cluster == "0B04" || descMap.clusterId == "0B04"){
|
else if (descMap.cluster == "0B04" || descMap.clusterId == "0B04"){
|
||||||
isDescriptionPower(descMap)
|
isDescriptionPower(descMap)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return [:]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(description?.startsWith("on/off:")) {
|
else if(description?.startsWith("on/off:")) {
|
||||||
def switchValue = description?.endsWith("1") ? "on" : "off"
|
def switchValue = description?.endsWith("1") ? "on" : "off"
|
||||||
return [type: "switch", value : switchValue]
|
return [type: "switch", value : switchValue]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "false"
|
return [:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +255,7 @@ def isDescriptionOnOff(descMap) {
|
|||||||
return [type: "switch", value : switchValue]
|
return [type: "switch", value : switchValue]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "false"
|
return [:]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -279,10 +282,9 @@ def isDescriptionLevel(descMap) {
|
|||||||
|
|
||||||
if (dimmerValue != -1){
|
if (dimmerValue != -1){
|
||||||
return [type: "level", value : dimmerValue]
|
return [type: "level", value : dimmerValue]
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "false"
|
return [:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +306,7 @@ def isDescriptionPower(descMap) {
|
|||||||
return [type: "power", value : powerValue]
|
return [type: "power", value : powerValue]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "false"
|
return [:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ metadata {
|
|||||||
definition (name: "Simulated Minimote", namespace: "smartthings/testing", author: "SmartThings") {
|
definition (name: "Simulated Minimote", namespace: "smartthings/testing", author: "SmartThings") {
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Button"
|
capability "Button"
|
||||||
capability "Holdable Button"
|
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
|
|
||||||
@@ -126,6 +125,3 @@ private hold(button) {
|
|||||||
sendEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was held", isStateChange: true)
|
sendEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was held", isStateChange: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
def updated() {
|
|
||||||
sendEvent(name: "numberOfButtons", value: 4)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ metadata {
|
|||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
capability "Button"
|
capability "Button"
|
||||||
capability "Holdable Button"
|
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ metadata {
|
|||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300", outClusters: "0019"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300", outClusters: "0019"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04", outClusters: "0019"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04", outClusters: "0019"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Flood BR30 Tunable White"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Flood BR30 Tunable White"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY RT Tunable White", deviceJoinName: "OSRAM LIGHTIFY RT5/6 Tunable White"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY RT Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Recessed Kit RT 5/6 Tunable White"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic A60 TW", deviceJoinName: "OSRAM LIGHTIFY LED Tunable White 60W"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic A60 TW", deviceJoinName: "OSRAM LIGHTIFY LED Tunable White 60W"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Tunable White 60W"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Tunable White 60W"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic B40 TW - LIGHTIFY", deviceJoinName: "OSRAM LIGHTIFY Classic B40 Tunable White"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic B40 TW - LIGHTIFY", deviceJoinName: "OSRAM LIGHTIFY Classic B40 Tunable White"
|
||||||
@@ -83,105 +83,24 @@ def parse(String description) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Map bindingTable = parseBindingTableResponse(description)
|
def cluster = zigbee.parse(description)
|
||||||
if (bindingTable) {
|
|
||||||
List<String> cmds = []
|
|
||||||
bindingTable.table_entries.inject(cmds) { acc, entry ->
|
|
||||||
// The binding entry is not for our hub and should be deleted
|
|
||||||
if (entry["dstAddr"] != zigbeeEui) {
|
|
||||||
acc.addAll(removeBinding(entry.clusterId, entry.srcAddr, entry.srcEndpoint, entry.dstAddr, entry.dstEndpoint))
|
|
||||||
}
|
|
||||||
acc
|
|
||||||
}
|
|
||||||
// There are more entries that we haven't examined yet
|
|
||||||
if (bindingTable.numTableEntries > bindingTable.startIndex + bindingTable.numEntriesReturned) {
|
|
||||||
def startPos
|
|
||||||
if (cmds) {
|
|
||||||
log.warn "Removing binding entries for other devices: $cmds"
|
|
||||||
// Since we are removing some entries, we should start in the same spot as we just read since values
|
|
||||||
// will fill in the newly vacated spots
|
|
||||||
startPos = bindingTable.startIndex
|
|
||||||
} else {
|
|
||||||
// Since we aren't removing anything we move forward to the next set of table entries
|
|
||||||
startPos = bindingTable.startIndex + bindingTable.numEntriesReturned
|
|
||||||
}
|
|
||||||
cmds.addAll(requestBindingTable(startPos))
|
|
||||||
}
|
|
||||||
sendHubCommand(cmds.collect { it ->
|
|
||||||
new physicalgraph.device.HubAction(it)
|
|
||||||
}, 2000)
|
|
||||||
} else {
|
|
||||||
def cluster = zigbee.parse(description)
|
|
||||||
|
|
||||||
if (cluster && cluster.clusterId == 0x0006 && cluster.command == 0x07) {
|
if (cluster && cluster.clusterId == 0x0006 && cluster.command == 0x07) {
|
||||||
if (cluster.data[0] == 0x00) {
|
if (cluster.data[0] == 0x00) {
|
||||||
log.debug "ON/OFF REPORTING CONFIG RESPONSE: " + cluster
|
log.debug "ON/OFF REPORTING CONFIG RESPONSE: " + cluster
|
||||||
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
}
|
|
||||||
else {
|
|
||||||
log.warn "ON/OFF REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "DID NOT PARSE MESSAGE for description : $description"
|
log.warn "ON/OFF REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
log.debug "${cluster}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
log.warn "DID NOT PARSE MESSAGE for description : $description"
|
||||||
|
log.debug "${cluster}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def parseBindingTableResponse(description) {
|
|
||||||
Map descMap = zigbee.parseDescriptionAsMap(description)
|
|
||||||
if (descMap["clusterInt"] == 0x8033) {
|
|
||||||
def header_field_lengths = ["transactionSeqNo": 1, "status": 1, "numTableEntries": 1, "startIndex": 1, "numEntriesReturned": 1]
|
|
||||||
def field_values = [:]
|
|
||||||
def data = descMap["data"]
|
|
||||||
header_field_lengths.each { k, v ->
|
|
||||||
field_values[k] = Integer.parseInt(data.take(v).join(""), 16);
|
|
||||||
data = data.drop(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Map> table = []
|
|
||||||
if (field_values.numEntriesReturned) {
|
|
||||||
def table_entry_lengths = ["srcAddr": 8, "srcEndpoint": 1, "clusterId": 2, "dstAddrMode": 1]
|
|
||||||
for (def i : 0..(field_values.numEntriesReturned - 1)) {
|
|
||||||
def entryMap = [:]
|
|
||||||
table_entry_lengths.each { k, v ->
|
|
||||||
def val = data.take(v).reverse().join("")
|
|
||||||
entryMap[k] = val.length() < 8 ? Integer.parseInt(val, 16) : val
|
|
||||||
data = data.drop(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (entryMap.dstAddrMode) {
|
|
||||||
case 0x01:
|
|
||||||
entryMap["dstAddr"] = data.take(2).reverse().join("")
|
|
||||||
data = data.drop(2)
|
|
||||||
break
|
|
||||||
case 0x03:
|
|
||||||
entryMap["dstAddr"] = data.take(8).reverse().join("")
|
|
||||||
data = data.drop(8)
|
|
||||||
entryMap["dstEndpoint"] = Integer.parseInt(data.take(1).join(""), 16)
|
|
||||||
data = data.drop(1)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
table << entryMap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
field_values["table_entries"] = table
|
|
||||||
return field_values
|
|
||||||
}
|
|
||||||
return [:]
|
|
||||||
}
|
|
||||||
|
|
||||||
def requestBindingTable(startPos=0) {
|
|
||||||
return ["zdo mgmt-bind 0x${zigbee.deviceNetworkId} $startPos"]
|
|
||||||
}
|
|
||||||
|
|
||||||
def removeBinding(cluster, srcAddr, srcEndpoint, destAddr, destEndpoint) {
|
|
||||||
return ["zdo unbind unicast 0x${zigbee.deviceNetworkId} {${srcAddr}} $srcEndpoint $cluster {${destAddr}} $destEndpoint"]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def off() {
|
def off() {
|
||||||
zigbee.off()
|
zigbee.off()
|
||||||
}
|
}
|
||||||
@@ -211,7 +130,8 @@ def configure() {
|
|||||||
// enrolls with default periodic reporting until newer 5 min interval is confirmed
|
// enrolls with default periodic reporting until newer 5 min interval is confirmed
|
||||||
sendEvent(name: "checkInterval", value: 2 * 10 * 60 + 1 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
sendEvent(name: "checkInterval", value: 2 * 10 * 60 + 1 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|
||||||
refresh() + requestBindingTable(0) + ["delay 2000"]
|
// OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity
|
||||||
|
refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
def setColorTemperature(value) {
|
def setColorTemperature(value) {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ def zwaveEvent(physicalgraph.zwave.commands.configurationv1.ConfigurationReport
|
|||||||
def value = "when off"
|
def value = "when off"
|
||||||
if (cmd.configurationValue[0] == 1) {value = "when on"}
|
if (cmd.configurationValue[0] == 1) {value = "when on"}
|
||||||
if (cmd.configurationValue[0] == 2) {value = "never"}
|
if (cmd.configurationValue[0] == 2) {value = "never"}
|
||||||
[name: "indicatorStatus", value: value, displayed: false]
|
[name: "indicatorStatus", value: value, display: false]
|
||||||
}
|
}
|
||||||
|
|
||||||
def zwaveEvent(physicalgraph.zwave.commands.hailv1.Hail cmd) {
|
def zwaveEvent(physicalgraph.zwave.commands.hailv1.Hail cmd) {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ def zwaveEvent(physicalgraph.zwave.commands.configurationv1.ConfigurationReport
|
|||||||
def value = "when off"
|
def value = "when off"
|
||||||
if (cmd.configurationValue[0] == 1) {value = "when on"}
|
if (cmd.configurationValue[0] == 1) {value = "when on"}
|
||||||
if (cmd.configurationValue[0] == 2) {value = "never"}
|
if (cmd.configurationValue[0] == 2) {value = "never"}
|
||||||
[name: "indicatorStatus", value: value, displayed: false]
|
[name: "indicatorStatus", value: value, display: false]
|
||||||
}
|
}
|
||||||
|
|
||||||
def zwaveEvent(physicalgraph.zwave.commands.hailv1.Hail cmd) {
|
def zwaveEvent(physicalgraph.zwave.commands.hailv1.Hail cmd) {
|
||||||
@@ -174,17 +174,17 @@ def refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void indicatorWhenOn() {
|
void indicatorWhenOn() {
|
||||||
sendEvent(name: "indicatorStatus", value: "when on", displayed: false)
|
sendEvent(name: "indicatorStatus", value: "when on", display: false)
|
||||||
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 3, size: 1).format()))
|
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 3, size: 1).format()))
|
||||||
}
|
}
|
||||||
|
|
||||||
void indicatorWhenOff() {
|
void indicatorWhenOff() {
|
||||||
sendEvent(name: "indicatorStatus", value: "when off", displayed: false)
|
sendEvent(name: "indicatorStatus", value: "when off", display: false)
|
||||||
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 3, size: 1).format()))
|
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 3, size: 1).format()))
|
||||||
}
|
}
|
||||||
|
|
||||||
void indicatorNever() {
|
void indicatorNever() {
|
||||||
sendEvent(name: "indicatorStatus", value: "never", displayed: false)
|
sendEvent(name: "indicatorStatus", value: "never", display: false)
|
||||||
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [2], parameterNumber: 3, size: 1).format()))
|
sendHubCommand(new physicalgraph.device.HubAction(zwave.configurationV1.configurationSet(configurationValue: [2], parameterNumber: 3, size: 1).format()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Color Coordinator
|
* Color Coordinator
|
||||||
* Version 1.1.0 - 11/9/16
|
* Version 1.0.0 - 7/4/15
|
||||||
* By Michael Struck
|
* By Michael Struck
|
||||||
*
|
*
|
||||||
* 1.0.0 - Initial release
|
* 1.0.0 - Initial release
|
||||||
* 1.1.0 - Fixed issue where master can be part of slaves. This causes a loop that impacts SmartThings.
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||||
@@ -32,35 +31,27 @@ preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def mainPage() {
|
def mainPage() {
|
||||||
dynamicPage(name: "mainPage", title: "", install: true, uninstall: false) {
|
dynamicPage(name: "mainPage", title: "", install: true, uninstall: true) {
|
||||||
def masterInList = slaves.id.find{it==master.id}
|
section("Master Light") {
|
||||||
if (masterInList) {
|
|
||||||
section ("**WARNING**"){
|
|
||||||
paragraph "You have included the Master Light in the Slave Group. This will cause a loop in execution. Please remove this device from the Slave Group.", image: "https://raw.githubusercontent.com/MichaelStruck/SmartThingsPublic/master/img/caution.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
section("Master Light") {
|
|
||||||
input "master", "capability.colorControl", title: "Colored Light"
|
input "master", "capability.colorControl", title: "Colored Light"
|
||||||
}
|
}
|
||||||
section("Lights that follow the master settings") {
|
section("Lights that follow the master settings") {
|
||||||
input "slaves", "capability.colorControl", title: "Colored Lights", multiple: true, required: false, submitOnChange: true
|
input "slaves", "capability.colorControl", title: "Colored Lights", multiple: true, required: false
|
||||||
}
|
}
|
||||||
section([mobileOnly:true], "Options") {
|
section([mobileOnly:true], "Options") {
|
||||||
input "randomYes", "bool",title: "When Master Turned On, Randomize Color", defaultValue: false
|
label(title: "Assign a name", required: false)
|
||||||
href "pageAbout", title: "About ${textAppName()}", description: "Tap to get application version, license and instructions"
|
href "pageAbout", title: "About ${textAppName()}", description: "Tap to get application version, license and instructions"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
page(name: "pageAbout", title: "About ${textAppName()}", uninstall: true) {
|
page(name: "pageAbout", title: "About ${textAppName()}") {
|
||||||
section {
|
section {
|
||||||
paragraph "${textVersion()}\n${textCopyright()}\n\n${textLicense()}\n"
|
paragraph "${textVersion()}\n${textCopyright()}\n\n${textLicense()}\n"
|
||||||
}
|
}
|
||||||
section("Instructions") {
|
section("Instructions") {
|
||||||
paragraph textHelp()
|
paragraph textHelp()
|
||||||
}
|
}
|
||||||
section("Tap button below to remove application"){
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def installed() {
|
def installed() {
|
||||||
@@ -81,55 +72,27 @@ def init() {
|
|||||||
}
|
}
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
def onOffHandler(evt){
|
def onOffHandler(evt){
|
||||||
if (!slaves.id.find{it==master.id}){
|
if (master.currentValue("switch") == "on"){
|
||||||
if (master.currentValue("switch") == "on"){
|
slaves?.on()
|
||||||
if (randomYes) getRandomColorMaster()
|
}
|
||||||
else slaves?.on()
|
else {
|
||||||
}
|
slaves?.off()
|
||||||
else {
|
}
|
||||||
slaves?.off()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def colorHandler(evt) {
|
def colorHandler(evt) {
|
||||||
if (!slaves.id.find{it==master.id} && master.currentValue("switch") == "on"){
|
def dimLevel = master.currentValue("level")
|
||||||
log.debug "Changing Slave units H,S,L"
|
def hueLevel = master.currentValue("hue")
|
||||||
def dimLevel = master.currentValue("level")
|
def saturationLevel = master.currentValue("saturation")
|
||||||
def hueLevel = master.currentValue("hue")
|
|
||||||
def saturationLevel = master.currentValue("saturation")
|
|
||||||
def newValue = [hue: hueLevel, saturation: saturationLevel, level: dimLevel as Integer]
|
|
||||||
slaves?.setColor(newValue)
|
|
||||||
try {
|
|
||||||
log.debug "Changing Slave color temp"
|
|
||||||
def tempLevel = master.currentValue("colorTemperature")
|
|
||||||
slaves?.setColorTemperature(tempLevel)
|
|
||||||
}
|
|
||||||
catch (e){
|
|
||||||
log.debug "Color temp for master --"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def getRandomColorMaster(){
|
|
||||||
def hueLevel = Math.floor(Math.random() *1000)
|
|
||||||
def saturationLevel = Math.floor(Math.random() * 100)
|
|
||||||
def dimLevel = master.currentValue("level")
|
|
||||||
def newValue = [hue: hueLevel, saturation: saturationLevel, level: dimLevel as Integer]
|
def newValue = [hue: hueLevel, saturation: saturationLevel, level: dimLevel as Integer]
|
||||||
log.debug hueLevel
|
|
||||||
log.debug saturationLevel
|
|
||||||
master.setColor(newValue)
|
|
||||||
slaves?.setColor(newValue)
|
slaves?.setColor(newValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
def tempHandler(evt){
|
def tempHandler(evt){
|
||||||
if (!slaves.id.find{it==master.id} && master.currentValue("switch") == "on"){
|
if (evt.value != "--") {
|
||||||
if (evt.value != "--") {
|
def tempLevel = master.currentValue("colorTemperature")
|
||||||
log.debug "Changing Slave color temp based on Master change"
|
slaves?.setColorTemperature(tempLevel)
|
||||||
def tempLevel = master.currentValue("colorTemperature")
|
}
|
||||||
slaves?.setColorTemperature(tempLevel)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Version/Copyright/Information/Help
|
//Version/Copyright/Information/Help
|
||||||
@@ -139,11 +102,11 @@ private def textAppName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def textVersion() {
|
private def textVersion() {
|
||||||
def text = "Version 1.1.0 (11/09/2016)"
|
def text = "Version 1.0.0 (07/04/2015)"
|
||||||
}
|
}
|
||||||
|
|
||||||
private def textCopyright() {
|
private def textCopyright() {
|
||||||
def text = "Copyright © 2016 Michael Struck"
|
def text = "Copyright © 2015 Michael Struck"
|
||||||
}
|
}
|
||||||
|
|
||||||
private def textLicense() {
|
private def textLicense() {
|
||||||
@@ -165,5 +128,5 @@ private def textHelp() {
|
|||||||
def text =
|
def text =
|
||||||
"This application will allow you to control the settings of multiple colored lights with one control. " +
|
"This application will allow you to control the settings of multiple colored lights with one control. " +
|
||||||
"Simply choose a master control light, and then choose the lights that will follow the settings of the master, "+
|
"Simply choose a master control light, and then choose the lights that will follow the settings of the master, "+
|
||||||
"including on/off conditions, hue, saturation, level and color temperature. Also includes a random color feature."
|
"including on/off conditions, hue, saturation, level and color temperature."
|
||||||
}
|
}
|
||||||
@@ -1,662 +0,0 @@
|
|||||||
import javax.crypto.Mac;
|
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
|
||||||
import java.security.InvalidKeyException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OpenT2T SmartApp Test
|
|
||||||
*
|
|
||||||
* Copyright 2016 OpenT2T
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
||||||
* in compliance with the License. You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
|
|
||||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing permissions and limitations under the License.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
definition(
|
|
||||||
name: "OpenT2T SmartApp Test",
|
|
||||||
namespace: "opent2t",
|
|
||||||
author: "OpenT2T",
|
|
||||||
description: "Test app to test end to end SmartThings scenarios via OpenT2T",
|
|
||||||
category: "SmartThings Labs",
|
|
||||||
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")
|
|
||||||
|
|
||||||
/** --------------------+---------------+-----------------------+------------------------------------
|
|
||||||
* Device Type | Attribute Name| Commands | Attribute Values
|
|
||||||
* --------------------+---------------+-----------------------+------------------------------------
|
|
||||||
* switches | switch | on, off | on, off
|
|
||||||
* motionSensors | motion | | active, inactive
|
|
||||||
* contactSensors | contact | | open, closed
|
|
||||||
* presenceSensors | presence | | present, 'not present'
|
|
||||||
* temperatureSensors | temperature | | <numeric, F or C according to unit>
|
|
||||||
* accelerationSensors | acceleration | | active, inactive
|
|
||||||
* waterSensors | water | | wet, dry
|
|
||||||
* lightSensors | illuminance | | <numeric, lux>
|
|
||||||
* humiditySensors | humidity | | <numeric, percent>
|
|
||||||
* locks | lock | lock, unlock | locked, unlocked
|
|
||||||
* garageDoors | door | open, close | unknown, closed, open, closing, opening
|
|
||||||
* cameras | image | take | <String>
|
|
||||||
* thermostats | thermostat | setHeatingSetpoint, | temperature, heatingSetpoint, coolingSetpoint,
|
|
||||||
* | | setCoolingSetpoint, | thermostatSetpoint, thermostatMode,
|
|
||||||
* | | off, heat, cool, auto,| thermostatFanMode, thermostatOperatingState
|
|
||||||
* | | emergencyHeat, |
|
|
||||||
* | | setThermostatMode, |
|
|
||||||
* | | fanOn, fanAuto, |
|
|
||||||
* | | fanCirculate, |
|
|
||||||
* | | setThermostatFanMode |
|
|
||||||
* --------------------+---------------+-----------------------+------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
//Device Inputs
|
|
||||||
preferences {
|
|
||||||
section("Allow OpenT2T to control these things...") {
|
|
||||||
input "contactSensors", "capability.contactSensor", title: "Which Contact Sensors", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
input "garageDoors", "capability.garageDoorControl", title: "Which Garage Doors?", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
input "locks", "capability.lock", title: "Which Locks?", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
input "cameras", "capability.videoCapture", title: "Which Cameras?", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
input "motionSensors", "capability.motionSensor", title: "Which Motion Sensors?", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
input "presenceSensors", "capability.presenceSensor", title: "Which Presence Sensors", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
input "switches", "capability.switch", title: "Which Switches and Lights?", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
input "thermostats", "capability.thermostat", title: "Which Thermostat?", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
input "waterSensors", "capability.waterSensor", title: "Which Water Leak Sensors?", multiple: true, required: false, hideWhenEmpty: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def getInputs() {
|
|
||||||
def inputList = []
|
|
||||||
inputList += contactSensors?: []
|
|
||||||
inputList += garageDoors?: []
|
|
||||||
inputList += locks?: []
|
|
||||||
inputList += cameras?: []
|
|
||||||
inputList += motionSensors?: []
|
|
||||||
inputList += presenceSensors?: []
|
|
||||||
inputList += switches?: []
|
|
||||||
inputList += thermostats?: []
|
|
||||||
inputList += waterSensors?: []
|
|
||||||
return inputList
|
|
||||||
}
|
|
||||||
|
|
||||||
//API external Endpoints
|
|
||||||
mappings {
|
|
||||||
path("/devices") {
|
|
||||||
action: [
|
|
||||||
GET: "getDevices"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/devices/:id") {
|
|
||||||
action: [
|
|
||||||
GET: "getDevice"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/update/:id") {
|
|
||||||
action: [
|
|
||||||
PUT: "updateDevice"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/deviceSubscription") {
|
|
||||||
action: [
|
|
||||||
POST: "registerDeviceChange",
|
|
||||||
DELETE: "unregisterDeviceChange"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/locationSubscription") {
|
|
||||||
action: [
|
|
||||||
POST: "registerDeviceGraph",
|
|
||||||
DELETE: "unregisterDeviceGraph"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def installed() {
|
|
||||||
log.debug "Installing with settings: ${settings}"
|
|
||||||
initialize()
|
|
||||||
}
|
|
||||||
|
|
||||||
def updated() {
|
|
||||||
log.debug "Updating with settings: ${settings}"
|
|
||||||
|
|
||||||
//Initialize state variables if didn't exist.
|
|
||||||
if( state.deviceSubscriptionMap == null ){
|
|
||||||
state.deviceSubscriptionMap = [:]
|
|
||||||
log.debug "deviceSubscriptionMap created."
|
|
||||||
}
|
|
||||||
if( state.locationSubscriptionMap == null ){
|
|
||||||
state.locationSubscriptionMap = [:]
|
|
||||||
log.debug "locationSubscriptionMap created."
|
|
||||||
}
|
|
||||||
if(state.verificationKeyMap == null){
|
|
||||||
state.verificationKeyMap = [:]
|
|
||||||
log.debug "verificationKeyMap created."
|
|
||||||
}
|
|
||||||
|
|
||||||
unsubscribe()
|
|
||||||
registerAllDeviceSubscriptions()
|
|
||||||
}
|
|
||||||
|
|
||||||
def initialize() {
|
|
||||||
log.debug "Initializing with settings: ${settings}"
|
|
||||||
state.deviceSubscriptionMap = [:]
|
|
||||||
log.debug "deviceSubscriptionMap created."
|
|
||||||
state.locationSubscriptionMap = [:]
|
|
||||||
log.debug "locationSubscriptionMap created."
|
|
||||||
state.verificationKeyMap = [:]
|
|
||||||
log.debug "verificationKeyMap created."
|
|
||||||
registerAllDeviceSubscriptions()
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Subscription Functions ***/
|
|
||||||
|
|
||||||
//Subscribe events for all devices
|
|
||||||
def registerAllDeviceSubscriptions() {
|
|
||||||
registerChangeHandler(inputs)
|
|
||||||
}
|
|
||||||
|
|
||||||
//Subscribe to events from a list of devices
|
|
||||||
def registerChangeHandler(myList) {
|
|
||||||
myList.each { myDevice ->
|
|
||||||
def theAtts = myDevice.supportedAttributes
|
|
||||||
theAtts.each {att ->
|
|
||||||
subscribe(myDevice, att.name, deviceEventHandler)
|
|
||||||
log.info "Registering for ${myDevice.displayName}.${att.name}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Endpoints function: Subscribe to events from a specific device
|
|
||||||
def registerDeviceChange() {
|
|
||||||
def subscriptionEndpt = params.subscriptionURL
|
|
||||||
def deviceId = params.deviceId
|
|
||||||
def myDevice = findDevice(deviceId)
|
|
||||||
|
|
||||||
if( myDevice == null ){
|
|
||||||
httpError(404, "Cannot find device with device ID ${deviceId}.")
|
|
||||||
}
|
|
||||||
|
|
||||||
def theAtts = myDevice.supportedAttributes
|
|
||||||
try {
|
|
||||||
theAtts.each {att ->
|
|
||||||
subscribe(myDevice, att.name, deviceEventHandler)
|
|
||||||
}
|
|
||||||
log.info "Subscribing for ${myDevice.displayName}"
|
|
||||||
|
|
||||||
if(subscriptionEndpt != null){
|
|
||||||
if(state.deviceSubscriptionMap[deviceId] == null){
|
|
||||||
state.deviceSubscriptionMap.put(deviceId, [subscriptionEndpt])
|
|
||||||
log.info "Added subscription URL: ${subscriptionEndpt} for ${myDevice.displayName}"
|
|
||||||
} else if (!state.deviceSubscriptionMap[deviceId].contains(subscriptionEndpt)){
|
|
||||||
// state.deviceSubscriptionMap[deviceId] << subscriptionEndpt
|
|
||||||
// For now, we will only have one subscription endpoint per device
|
|
||||||
state.deviceSubscriptionMap.remove(deviceId)
|
|
||||||
state.deviceSubscriptionMap.put(deviceId, [subscriptionEndpt])
|
|
||||||
log.info "Added subscription URL: ${subscriptionEndpt} for ${myDevice.displayName}"
|
|
||||||
}
|
|
||||||
|
|
||||||
if(params.key != null){
|
|
||||||
state.verificationKeyMap[subscriptionEndpt] = params.key
|
|
||||||
log.info "Added verification key: ${params.key} for ${subscriptionEndpt}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
httpError(500, "something went wrong: $e")
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info "Current subscription map is ${state.deviceSubscriptionMap}"
|
|
||||||
log.info "Current verification key map is ${state.verificationKeyMap}"
|
|
||||||
return ["succeed"]
|
|
||||||
}
|
|
||||||
|
|
||||||
//Endpoints function: Unsubscribe to events from a specific device
|
|
||||||
def unregisterDeviceChange() {
|
|
||||||
def subscriptionEndpt = params.subscriptionURL
|
|
||||||
def deviceId = params.deviceId
|
|
||||||
def myDevice = findDevice(deviceId)
|
|
||||||
|
|
||||||
if( myDevice == null ){
|
|
||||||
httpError(404, "Cannot find device with device ID ${deviceId}.")
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if(subscriptionEndpt != null && subscriptionEndpt != "undefined"){
|
|
||||||
if (state.deviceSubscriptionMap[deviceId]?.contains(subscriptionEndpt)){
|
|
||||||
if(state.deviceSubscriptionMap[deviceId].size() == 1){
|
|
||||||
state.deviceSubscriptionMap.remove(deviceId)
|
|
||||||
} else {
|
|
||||||
state.deviceSubscriptionMap[deviceId].remove(subscriptionEndpt)
|
|
||||||
}
|
|
||||||
state.verificationKeyMap.remove(subscriptionEndpt)
|
|
||||||
log.info "Removed subscription URL: ${subscriptionEndpt} for ${myDevice.displayName}"
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
state.deviceSubscriptionMap.remove(deviceId)
|
|
||||||
log.info "Unsubscriping for ${myDevice.displayName}"
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
httpError(500, "something went wrong: $e")
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info "Current subscription map is ${state.deviceSubscriptionMap}"
|
|
||||||
log.info "Current verification key map is ${state.verificationKeyMap}"
|
|
||||||
}
|
|
||||||
|
|
||||||
//Endpoints function: Subscribe to device additiona/removal updated in a location
|
|
||||||
def registerDeviceGraph() {
|
|
||||||
def subscriptionEndpt = params.subscriptionURL
|
|
||||||
|
|
||||||
if (subscriptionEndpt != null && subscriptionEndpt != "undefined"){
|
|
||||||
subscribe(location, "DeviceCreated", locationEventHandler, [filterEvents: false])
|
|
||||||
subscribe(location, "DeviceUpdated", locationEventHandler, [filterEvents: false])
|
|
||||||
subscribe(location, "DeviceDeleted", locationEventHandler, [filterEvents: false])
|
|
||||||
|
|
||||||
if(state.locationSubscriptionMap[location.id] == null){
|
|
||||||
state.locationSubscriptionMap.put(location.id, [subscriptionEndpt])
|
|
||||||
log.info "Added subscription URL: ${subscriptionEndpt} for Location ${location.name}"
|
|
||||||
}else if (!state.locationSubscriptionMap[location.id].contains(subscriptionEndpt)){
|
|
||||||
state.locationSubscriptionMap[location.id] << subscriptionEndpt
|
|
||||||
log.info "Added subscription URL: ${subscriptionEndpt} for Location ${location.name}"
|
|
||||||
}
|
|
||||||
|
|
||||||
if(params.key != null){
|
|
||||||
state.verificationKeyMap[subscriptionEndpt] = params.key
|
|
||||||
log.info "Added verification key: ${params.key} for ${subscriptionEndpt}"
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info "Current location subscription map is ${state.locationSubscriptionMap}"
|
|
||||||
log.info "Current verification key map is ${state.verificationKeyMap}"
|
|
||||||
return ["succeed"]
|
|
||||||
} else {
|
|
||||||
httpError(400, "missing input parameter: subscriptionURL")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Endpoints function: Unsubscribe to events from a specific device
|
|
||||||
def unregisterDeviceGraph() {
|
|
||||||
def subscriptionEndpt = params.subscriptionURL
|
|
||||||
|
|
||||||
try {
|
|
||||||
if(subscriptionEndpt != null && subscriptionEndpt != "undefined"){
|
|
||||||
if (state.locationSubscriptionMap[location.id]?.contains(subscriptionEndpt)){
|
|
||||||
if(state.locationSubscriptionMap[location.id].size() == 1){
|
|
||||||
state.locationSubscriptionMap.remove(location.id)
|
|
||||||
} else {
|
|
||||||
state.locationSubscriptionMap[location.id].remove(subscriptionEndpt)
|
|
||||||
}
|
|
||||||
state.verificationKeyMap.remove(subscriptionEndpt)
|
|
||||||
log.info "Removed subscription URL: ${subscriptionEndpt} for Location ${location.name}"
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
httpError(400, "missing input parameter: subscriptionURL")
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
httpError(500, "something went wrong: $e")
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info "Current location subscription map is ${state.locationSubscriptionMap}"
|
|
||||||
log.info "Current verification key map is ${state.verificationKeyMap}"
|
|
||||||
}
|
|
||||||
|
|
||||||
//When events are triggered, send HTTP post to web socket servers
|
|
||||||
def deviceEventHandler(evt) {
|
|
||||||
def evtDevice = evt.device
|
|
||||||
def evtDeviceType = getDeviceType(evtDevice)
|
|
||||||
def deviceData = [];
|
|
||||||
|
|
||||||
if(evt.data != null){
|
|
||||||
def evtData = parseJson(evt.data)
|
|
||||||
log.info "Received event for ${evtDevice.displayName}, data: ${evtData}, description: ${evt.descriptionText}"
|
|
||||||
}
|
|
||||||
|
|
||||||
if(evtDeviceType == "thermostat") {
|
|
||||||
deviceData = [name: evtDevice.displayName, id: evtDevice.id, status:evtDevice.status, deviceType:evtDeviceType, manufacturer:evtDevice.manufacturerName, model:evtDevice.modelName, attributes: deviceAttributeList(evtDevice, evtDeviceType), locationMode: getLocationModeInfo(), locationId: location.id ]
|
|
||||||
} else {
|
|
||||||
deviceData = [name: evtDevice.displayName, id: evtDevice.id, status:evtDevice.status, deviceType:evtDeviceType, manufacturer:evtDevice.manufacturerName, model:evtDevice.modelName, attributes: deviceAttributeList(evtDevice, evtDeviceType), locationId: location.id ]
|
|
||||||
}
|
|
||||||
|
|
||||||
def params = [ body: deviceData ]
|
|
||||||
|
|
||||||
//send event to all subscriptions urls
|
|
||||||
log.debug "Current subscription urls for ${evtDevice.displayName} is ${state.deviceSubscriptionMap[evtDevice.id]}"
|
|
||||||
state.deviceSubscriptionMap[evtDevice.id].each {
|
|
||||||
params.uri = "${it}"
|
|
||||||
if(state.verificationKeyMap[it] != null ){
|
|
||||||
def key = state.verificationKeyMap[it]
|
|
||||||
params.header = [Signature: ComputHMACValue(key, groovy.json.JsonOutput.toJson(params.body))]
|
|
||||||
}
|
|
||||||
log.trace "POST URI: ${params.uri}"
|
|
||||||
log.trace "Header: ${params.header}"
|
|
||||||
log.trace "Payload: ${params.body}"
|
|
||||||
try{
|
|
||||||
httpPostJson(params) { resp ->
|
|
||||||
log.trace "response status code: ${resp.status}"
|
|
||||||
log.trace "response data: ${resp.data}"
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
log.error "something went wrong: $e"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def locationEventHandler(evt) {
|
|
||||||
log.info "Received event for location ${location.name}/${location.id}, Event: ${evt.name}, description: ${evt.descriptionText}, apiServerUrl: ${apiServerUrl("")}"
|
|
||||||
switch(evt.name){
|
|
||||||
case "DeviceCreated":
|
|
||||||
case "DeviceDeleted":
|
|
||||||
def evtDevice = evt.device
|
|
||||||
def evtDeviceType = getDeviceType(evtDevice)
|
|
||||||
def params = [ body: [ eventType:evt.name, deviceId: evtDevice.id, locationId: location.id ] ]
|
|
||||||
|
|
||||||
if (evt.name == "DeviceDeleted" && state.deviceSubscriptionMap[deviceId] != null){
|
|
||||||
state.deviceSubscriptionMap.remove(evtDevice.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
state.locationSubscriptionMap[location.id].each {
|
|
||||||
params.uri = "${it}"
|
|
||||||
if(state.verificationKeyMap[it] != null ){
|
|
||||||
def key = state.verificationKeyMap[it]
|
|
||||||
params.header = [Signature: ComputHMACValue(key, groovy.json.JsonOutput.toJson(params.body))]
|
|
||||||
}
|
|
||||||
log.trace "POST URI: ${params.uri}"
|
|
||||||
log.trace "Header: ${params.header}"
|
|
||||||
log.trace "Payload: ${params.body}"
|
|
||||||
try{
|
|
||||||
httpPostJson(params) { resp ->
|
|
||||||
log.trace "response status code: ${resp.status}"
|
|
||||||
log.trace "response data: ${resp.data}"
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
log.error "something went wrong: $e"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "DeviceUpdated":
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ComputHMACValue(key, data){
|
|
||||||
try {
|
|
||||||
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA1")
|
|
||||||
Mac mac = Mac.getInstance("HmacSHA1")
|
|
||||||
mac.init(secretKeySpec)
|
|
||||||
byte[] digest = mac.doFinal(data.getBytes("UTF-8"))
|
|
||||||
return byteArrayToString(digest)
|
|
||||||
} catch (InvalidKeyException e) {
|
|
||||||
log.error "Invalid key exception while converting to HMac SHA1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private def byteArrayToString(byte[] data) {
|
|
||||||
BigInteger bigInteger = new BigInteger(1, data)
|
|
||||||
String hash = bigInteger.toString(16)
|
|
||||||
return hash
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Device Query/Update Functions ***/
|
|
||||||
|
|
||||||
//Endpoints function: return all device data in json format
|
|
||||||
def getDevices() {
|
|
||||||
def deviceData = []
|
|
||||||
inputs?.each {
|
|
||||||
def deviceType = getDeviceType(it)
|
|
||||||
if(deviceType == "thermostat") {
|
|
||||||
deviceData << [name: it.displayName, id: it.id, status:it.status, deviceType:deviceType, manufacturer:it.manufacturerName, model:it.modelName, attributes: deviceAttributeList(it, deviceType), locationMode: getLocationModeInfo()]
|
|
||||||
} else {
|
|
||||||
deviceData << [name: it.displayName, id: it.id, status:it.status, deviceType:deviceType, manufacturer:it.manufacturerName, model:it.modelName, attributes: deviceAttributeList(it, deviceType)]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug "getDevices, return: ${deviceData}"
|
|
||||||
return deviceData
|
|
||||||
}
|
|
||||||
|
|
||||||
//Endpoints function: get device data
|
|
||||||
def getDevice() {
|
|
||||||
def it = findDevice(params.id)
|
|
||||||
def deviceType = getDeviceType(it)
|
|
||||||
def device
|
|
||||||
if(deviceType == "thermostat") {
|
|
||||||
device = [name: it.displayName, id: it.id, status:it.status, deviceType:deviceType, manufacturer:it.manufacturerName, model:it.modelName, attributes: deviceAttributeList(it,deviceType), locationMode: getLocationModeInfo()]
|
|
||||||
} else {
|
|
||||||
device = [name: it.displayName, id: it.id, status:it.status, deviceType:deviceType, manufacturer:it.manufacturerName, model:it.modelName, attributes: deviceAttributeList(it, deviceType)]
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug "getDevice, return: ${device}"
|
|
||||||
return device
|
|
||||||
}
|
|
||||||
|
|
||||||
//Endpoints function: update device data
|
|
||||||
void updateDevice() {
|
|
||||||
def device = findDevice(params.id)
|
|
||||||
request.JSON.each {
|
|
||||||
def command = it.key
|
|
||||||
def value = it.value
|
|
||||||
if (command){
|
|
||||||
def commandList = mapDeviceCommands(command, value)
|
|
||||||
command = commandList[0]
|
|
||||||
value = commandList[1]
|
|
||||||
|
|
||||||
if (command == "setAwayMode") {
|
|
||||||
log.info "Setting away mode to ${value}"
|
|
||||||
if (location.modes?.find {it.name == value}) {
|
|
||||||
location.setMode(value)
|
|
||||||
}
|
|
||||||
}else if (command == "thermostatSetpoint"){
|
|
||||||
switch(device.currentThermostatMode){
|
|
||||||
case "cool":
|
|
||||||
log.info "Update: ${device.displayName}, [${command}, ${value}]"
|
|
||||||
device.setCoolingSetpoint(value)
|
|
||||||
break
|
|
||||||
case "heat":
|
|
||||||
case "emergency heat":
|
|
||||||
log.info "Update: ${device.displayName}, [${command}, ${value}]"
|
|
||||||
device.setHeatingSetpoint(value)
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
httpError(501, "this mode: ${device.currentThermostatMode} does not allow changing thermostat setpoint.")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}else if (!device) {
|
|
||||||
log.error "updateDevice, Device not found"
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else if (!device.hasCommand(command)) {
|
|
||||||
log.error "updateDevice, Device does not have the command"
|
|
||||||
httpError(404, "Device does not have such command")
|
|
||||||
} else {
|
|
||||||
if (command == "setColor") {
|
|
||||||
log.info "Update: ${device.displayName}, [${command}, ${value}]"
|
|
||||||
device."$command"(hex: value)
|
|
||||||
} else if(value.isNumber()) {
|
|
||||||
def intValue = value as Integer
|
|
||||||
log.info "Update: ${device.displayName}, [${command}, ${intValue}(int)]"
|
|
||||||
device."$command"(intValue)
|
|
||||||
} else if (value){
|
|
||||||
log.info "Update: ${device.displayName}, [${command}, ${value}]"
|
|
||||||
device."$command"(value)
|
|
||||||
} else {
|
|
||||||
log.info "Update: ${device.displayName}, [${command}]"
|
|
||||||
device."$command"()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Private Functions ***/
|
|
||||||
|
|
||||||
//Return current location mode info
|
|
||||||
private getLocationModeInfo() {
|
|
||||||
return [mode: location.mode, supported: location.modes.name]
|
|
||||||
}
|
|
||||||
|
|
||||||
//Map each device to a type given it's capabilities
|
|
||||||
private getDeviceType(device) {
|
|
||||||
def deviceType
|
|
||||||
def capabilities = device.capabilities
|
|
||||||
log.debug "capabilities: [${device}, ${capabilities}]"
|
|
||||||
log.debug "supported commands: [${device}, ${device.supportedCommands}]"
|
|
||||||
|
|
||||||
//Loop through the device capability list to determine the device type.
|
|
||||||
capabilities.each {capability ->
|
|
||||||
switch(capability.name.toLowerCase())
|
|
||||||
{
|
|
||||||
case "switch":
|
|
||||||
deviceType = "switch"
|
|
||||||
|
|
||||||
//If the device also contains "Switch Level" capability, identify it as a "light" device.
|
|
||||||
if (capabilities.any{it.name.toLowerCase() == "switch level"}){
|
|
||||||
|
|
||||||
//If the device also contains "Power Meter" capability, identify it as a "dimmerSwitch" device.
|
|
||||||
if (capabilities.any{it.name.toLowerCase() == "power meter"}){
|
|
||||||
deviceType = "dimmerSwitch"
|
|
||||||
return deviceType
|
|
||||||
} else {
|
|
||||||
deviceType = "light"
|
|
||||||
return deviceType
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "garageDoorControl":
|
|
||||||
deviceType = "garageDoor"
|
|
||||||
return deviceType
|
|
||||||
case "lock":
|
|
||||||
deviceType = "lock"
|
|
||||||
return deviceType
|
|
||||||
case "video camera":
|
|
||||||
deviceType = "camera"
|
|
||||||
return deviceType
|
|
||||||
case "thermostat":
|
|
||||||
deviceType = "thermostat"
|
|
||||||
return deviceType
|
|
||||||
case "acceleration sensor":
|
|
||||||
case "contact sensor":
|
|
||||||
case "motion sensor":
|
|
||||||
case "presence sensor":
|
|
||||||
case "water sensor":
|
|
||||||
deviceType = "genericSensor"
|
|
||||||
return deviceType
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return deviceType
|
|
||||||
}
|
|
||||||
|
|
||||||
//Return a specific device give the device ID.
|
|
||||||
private findDevice(deviceId) {
|
|
||||||
return inputs?.find { it.id == deviceId }
|
|
||||||
}
|
|
||||||
|
|
||||||
//Return a list of device attributes
|
|
||||||
private deviceAttributeList(device, deviceType) {
|
|
||||||
def attributeList = [:]
|
|
||||||
def allAttributes = device.supportedAttributes
|
|
||||||
allAttributes.each { attribute ->
|
|
||||||
try {
|
|
||||||
def currentState = device.currentState(attribute.name)
|
|
||||||
if(currentState != null ){
|
|
||||||
switch(attribute.name){
|
|
||||||
case 'temperature':
|
|
||||||
attributeList.putAll([ (attribute.name): currentState.value, 'temperatureScale':location.temperatureScale ])
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
attributeList.putAll([(attribute.name): currentState.value ])
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( deviceType == "genericSensor" ){
|
|
||||||
def key = attribute.name + "_lastUpdated"
|
|
||||||
attributeList.putAll([ (key): currentState.isoDate ])
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
attributeList.putAll([ (attribute.name): null ]);
|
|
||||||
}
|
|
||||||
} catch(e) {
|
|
||||||
attributeList.putAll([ (attribute.name): null ]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return attributeList
|
|
||||||
}
|
|
||||||
|
|
||||||
//Map device command and value.
|
|
||||||
//input command and value are from UWP,
|
|
||||||
//returns resultCommand and resultValue that corresponds with function and value in SmartApps
|
|
||||||
private mapDeviceCommands(command, value) {
|
|
||||||
log.debug "mapDeviceCommands: [${command}, ${value}]"
|
|
||||||
def resultCommand = command
|
|
||||||
def resultValue = value
|
|
||||||
switch (command) {
|
|
||||||
case "switch":
|
|
||||||
if (value == 1 || value == "1" || value == "on") {
|
|
||||||
resultCommand = "on"
|
|
||||||
resultValue = ""
|
|
||||||
} else if (value == 0 || value == "0" || value == "off") {
|
|
||||||
resultCommand = "off"
|
|
||||||
resultValue = ""
|
|
||||||
}
|
|
||||||
break
|
|
||||||
// light attributes
|
|
||||||
case "level":
|
|
||||||
resultCommand = "setLevel"
|
|
||||||
resultValue = value
|
|
||||||
break
|
|
||||||
case "hue":
|
|
||||||
resultCommand = "setHue"
|
|
||||||
resultValue = value
|
|
||||||
break
|
|
||||||
case "saturation":
|
|
||||||
resultCommand = "setSaturation"
|
|
||||||
resultValue = value
|
|
||||||
break
|
|
||||||
case "colorTemperature":
|
|
||||||
resultCommand = "setColorTemperature"
|
|
||||||
resultValue = value
|
|
||||||
break
|
|
||||||
case "color":
|
|
||||||
resultCommand = "setColor"
|
|
||||||
resultValue = value
|
|
||||||
// thermostat attributes
|
|
||||||
case "hvacMode":
|
|
||||||
resultCommand = "setThermostatMode"
|
|
||||||
resultValue = value
|
|
||||||
break
|
|
||||||
case "fanMode":
|
|
||||||
resultCommand = "setThermostatFanMode"
|
|
||||||
resultValue = value
|
|
||||||
break
|
|
||||||
case "awayMode":
|
|
||||||
resultCommand = "setAwayMode"
|
|
||||||
resultValue = value
|
|
||||||
break
|
|
||||||
case "coolingSetpoint":
|
|
||||||
resultCommand = "setCoolingSetpoint"
|
|
||||||
resultValue = value
|
|
||||||
break
|
|
||||||
case "heatingSetpoint":
|
|
||||||
resultCommand = "setHeatingSetpoint"
|
|
||||||
resultValue = value
|
|
||||||
break
|
|
||||||
case "thermostatSetpoint":
|
|
||||||
resultCommand = "thermostatSetpoint"
|
|
||||||
resultValue = value
|
|
||||||
break
|
|
||||||
// lock attributes
|
|
||||||
case "locked":
|
|
||||||
if (value == 1 || value == "1" || value == "lock") {
|
|
||||||
resultCommand = "lock"
|
|
||||||
resultValue = ""
|
|
||||||
}
|
|
||||||
else if (value == 0 || value == "0" || value == "unlock") {
|
|
||||||
resultCommand = "unlock"
|
|
||||||
resultValue = ""
|
|
||||||
}
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
return [resultCommand,resultValue]
|
|
||||||
}
|
|
||||||
@@ -516,7 +516,7 @@ def pollResponse(response, data) {
|
|||||||
def hub = getChildDevice("harmony-${it.key}")
|
def hub = getChildDevice("harmony-${it.key}")
|
||||||
if (hub) {
|
if (hub) {
|
||||||
if (it.value.response.data.currentAvActivity == "-1") {
|
if (it.value.response.data.currentAvActivity == "-1") {
|
||||||
hub.sendEvent(name: "currentActivity", value: "--", descriptionText: "There isn't any activity running", displayed: false)
|
hub.sendEvent(name: "currentActivity", value: "--", descriptionText: "There isn't any activity running", display: false)
|
||||||
} else {
|
} else {
|
||||||
def currentActivity
|
def currentActivity
|
||||||
def activityDTH = getChildDevice("harmony-${it.key}-${it.value.response.data.currentAvActivity}")
|
def activityDTH = getChildDevice("harmony-${it.key}-${it.value.response.data.currentAvActivity}")
|
||||||
@@ -524,7 +524,7 @@ def pollResponse(response, data) {
|
|||||||
currentActivity = activityDTH.device.displayName
|
currentActivity = activityDTH.device.displayName
|
||||||
else
|
else
|
||||||
currentActivity = getActivityName(it.value.response.data.currentAvActivity,it.key)
|
currentActivity = getActivityName(it.value.response.data.currentAvActivity,it.key)
|
||||||
hub.sendEvent(name: "currentActivity", value: currentActivity, descriptionText: "Current activity is ${currentActivity}", displayed: false)
|
hub.sendEvent(name: "currentActivity", value: currentActivity, descriptionText: "Current activity is ${currentActivity}", display: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -576,7 +576,7 @@ def getActivityList() {
|
|||||||
}
|
}
|
||||||
activities += [id: "off", name: "Activity OFF", type: "0"]
|
activities += [id: "off", name: "Activity OFF", type: "0"]
|
||||||
}
|
}
|
||||||
hub.sendEvent(name: "activities", value: new groovy.json.JsonBuilder(activities).toString(), descriptionText: "Activities are ${activities.collect { it.name }?.join(', ')}", displayed: false)
|
hub.sendEvent(name: "activities", value: new groovy.json.JsonBuilder(activities).toString(), descriptionText: "Activities are ${activities.collect { it.name }?.join(', ')}", display: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user