mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-19 05:10:51 +00:00
Compare commits
36 Commits
PROD_2016.
...
MSA-1716-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38ee1bd866 | ||
|
|
5ad20fbd2a | ||
|
|
076ffecd19 | ||
|
|
52357e4c50 | ||
|
|
f969027191 | ||
|
|
8db0556696 | ||
|
|
5607a3e346 | ||
|
|
490ec329cb | ||
|
|
3109049122 | ||
|
|
930c4ed914 | ||
|
|
259516f21f | ||
|
|
b7a08a88e0 | ||
|
|
c028515fcd | ||
|
|
751c98d123 | ||
|
|
5b874e8f3a | ||
|
|
9e10405527 | ||
|
|
32ceaff54d | ||
|
|
5b1da30a47 | ||
|
|
76e139153a | ||
|
|
a4bc248006 | ||
|
|
e7eb461b4e | ||
|
|
0a82077b24 | ||
|
|
083ed7cc9a | ||
|
|
38ef9e5c77 | ||
|
|
6a71615ca5 | ||
|
|
9939591005 | ||
|
|
d7f2bc1d79 | ||
|
|
3c5d727d4c | ||
|
|
bbad6dfa7a | ||
|
|
df6c815aa4 | ||
|
|
d16ac00eb6 | ||
|
|
1941f56007 | ||
|
|
f34df19a65 | ||
|
|
af40246655 | ||
|
|
60756e6dc6 | ||
|
|
61d1205e7d |
@@ -22,9 +22,10 @@ metadata {
|
|||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Health Check"
|
capability "Health Check"
|
||||||
|
|
||||||
fingerprint mfr:"0063", prod:"4457", deviceJoinName: "Z-Wave Wall Dimmer"
|
fingerprint mfr:"0063", prod:"4457", deviceJoinName: "GE In-Wall Smart Dimmer "
|
||||||
fingerprint mfr:"0063", prod:"4944", deviceJoinName: "Z-Wave Wall Dimmer"
|
fingerprint mfr:"0063", prod:"4944", deviceJoinName: "GE In-Wall Smart Dimmer "
|
||||||
fingerprint mfr:"0063", prod:"5044", deviceJoinName: "Z-Wave Plug-In Dimmer"
|
fingerprint mfr:"0063", prod:"5044", deviceJoinName: "GE Plug-In Smart Dimmer "
|
||||||
|
fingerprint mfr:"0063", prod:"4944", model:"3034", deviceJoinName: "GE In-Wall Smart Fan Control"
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ def parse(String description) {
|
|||||||
|
|
||||||
def poll() {
|
def poll() {
|
||||||
def refreshCmds = [
|
def refreshCmds = [
|
||||||
"st wattr 0x${device.deviceNetworkId} 1 8 0x10 0x21 {${state?.dOnOff ?: '0000'}}", "delay 500"
|
"st wattr 0x${device.deviceNetworkId} 1 8 0x10 0x21 {${state?.dOnOff ?: '0000'}}", "delay 2000"
|
||||||
]
|
]
|
||||||
|
|
||||||
return refreshCmds + zigbee.onOffRefresh() + zigbee.levelRefresh()
|
return refreshCmds + zigbee.onOffRefresh() + zigbee.levelRefresh()
|
||||||
@@ -197,7 +197,7 @@ def off() {
|
|||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
def refreshCmds = [
|
def refreshCmds = [
|
||||||
"st wattr 0x${device.deviceNetworkId} 1 8 0x10 0x21 {${state?.dOnOff ?: '0000'}}", "delay 500"
|
"st wattr 0x${device.deviceNetworkId} 1 8 0x10 0x21 {${state?.dOnOff ?: '0000'}}", "delay 2000"
|
||||||
]
|
]
|
||||||
|
|
||||||
return refreshCmds + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.onOffConfig()
|
return refreshCmds + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.onOffConfig()
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ metadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def generatePresenceEvent(boolean present) {
|
def generatePresenceEvent(boolean present) {
|
||||||
log.debug "Here in generatePresenceEvent!"
|
log.info "Life360 generatePresenceEvent($present)"
|
||||||
def value = formatValue(present)
|
def value = formatValue(present)
|
||||||
def linkText = getLinkText(device)
|
def linkText = getLinkText(device)
|
||||||
def descriptionText = formatDescriptionText(linkText, present)
|
def descriptionText = formatDescriptionText(linkText, present)
|
||||||
|
|||||||
@@ -128,9 +128,9 @@ def setLevel(value) {
|
|||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
[
|
[
|
||||||
"st rattr 0x${device.deviceNetworkId} ${endpointId} 6 0", "delay 500",
|
"st rattr 0x${device.deviceNetworkId} ${endpointId} 6 0", "delay 2000",
|
||||||
"st rattr 0x${device.deviceNetworkId} ${endpointId} 8 0", "delay 500",
|
"st rattr 0x${device.deviceNetworkId} ${endpointId} 8 0", "delay 2000",
|
||||||
"st rattr 0x${device.deviceNetworkId} ${endpointId} 0x0B04 0x050B", "delay 500"
|
"st rattr 0x${device.deviceNetworkId} ${endpointId} 0x0B04 0x050B", "delay 2000"
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -313,9 +313,9 @@ def isDescriptionPower(descMap) {
|
|||||||
|
|
||||||
def onOffConfig() {
|
def onOffConfig() {
|
||||||
[
|
[
|
||||||
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 6 {${device.zigbeeId}} {}", "delay 200",
|
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 6 {${device.zigbeeId}} {}", "delay 2000",
|
||||||
"zcl global send-me-a-report 6 0 0x10 0 600 {01}",
|
"zcl global send-me-a-report 6 0 0x10 0 600 {01}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 1500"
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 2000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,9 +323,9 @@ def onOffConfig() {
|
|||||||
//min level change is 01
|
//min level change is 01
|
||||||
def levelConfig() {
|
def levelConfig() {
|
||||||
[
|
[
|
||||||
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 8 {${device.zigbeeId}} {}", "delay 200",
|
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 8 {${device.zigbeeId}} {}", "delay 2000",
|
||||||
"zcl global send-me-a-report 8 0 0x20 5 3600 {01}",
|
"zcl global send-me-a-report 8 0 0x20 5 3600 {01}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 1500"
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 2000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,9 +333,10 @@ def levelConfig() {
|
|||||||
//min change in value is 05
|
//min change in value is 05
|
||||||
def powerConfig() {
|
def powerConfig() {
|
||||||
[
|
[
|
||||||
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x0B04 {${device.zigbeeId}} {}", "delay 200",
|
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x0B04 {${device.zigbeeId}} {}", "delay 2000",
|
||||||
"zcl global send-me-a-report 0x0B04 0x050B 0x29 1 600 {05 00}", //The send-me-a-report is custom to the attribute type for CentraLite
|
"zcl global send-me-a-report 0x0B04 0x050B 0x29 1 600 {05 00}", //The send-me-a-report is custom to the attribute type for CentraLite
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500"
|
"delay 200",
|
||||||
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 2000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +345,10 @@ def setLevelWithRate(level, rate) {
|
|||||||
rate = "0000"
|
rate = "0000"
|
||||||
}
|
}
|
||||||
level = convertToHexString(level * 255 / 100) //Converting the 0-100 range to 0-FF range in hex
|
level = convertToHexString(level * 255 / 100) //Converting the 0-100 range to 0-FF range in hex
|
||||||
"st cmd 0x${device.deviceNetworkId} ${endpointId} 8 4 {$level $rate}"
|
[
|
||||||
|
"st cmd 0x${device.deviceNetworkId} ${endpointId} 8 4 {$level $rate}",
|
||||||
|
"delay 2000"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
String convertToHexString(value, width=2) {
|
String convertToHexString(value, width=2) {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ def on() {
|
|||||||
'zcl on-off on',
|
'zcl on-off on',
|
||||||
'delay 200',
|
'delay 200',
|
||||||
"send 0x${zigbee.deviceNetworkId} 0x01 0x${zigbee.endpointId}",
|
"send 0x${zigbee.deviceNetworkId} 0x01 0x${zigbee.endpointId}",
|
||||||
'delay 500'
|
'delay 2000'
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -62,6 +62,6 @@ def off() {
|
|||||||
'zcl on-off off',
|
'zcl on-off off',
|
||||||
'delay 200',
|
'delay 200',
|
||||||
"send 0x${zigbee.deviceNetworkId} 0x01 0x${zigbee.endpointId}",
|
"send 0x${zigbee.deviceNetworkId} 0x01 0x${zigbee.endpointId}",
|
||||||
'delay 500'
|
'delay 2000'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,9 +157,10 @@ def configure() {
|
|||||||
//min change in value is 01
|
//min change in value is 01
|
||||||
def powerConfig() {
|
def powerConfig() {
|
||||||
[
|
[
|
||||||
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x0B04 {${device.zigbeeId}} {}", "delay 200",
|
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x0B04 {${device.zigbeeId}} {}", "delay 2000",
|
||||||
"zcl global send-me-a-report 0x0B04 0x050B 0x29 1 600 {05 00}", //The send-me-a-report is custom to the attribute type for CentraLite
|
"zcl global send-me-a-report 0x0B04 0x050B 0x29 1 600 {05 00}", //The send-me-a-report is custom to the attribute type for CentraLite
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500"
|
"delay 200",
|
||||||
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 2000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,10 @@ metadata {
|
|||||||
command "enrollResponse"
|
command "enrollResponse"
|
||||||
|
|
||||||
|
|
||||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3315-S", deviceJoinName: "Water Leak Sensor"
|
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3315-S", deviceJoinName: "Water Leak Sensor"
|
||||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3315"
|
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3315"
|
||||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3315-Seu", deviceJoinName: "Water Leak Sensor"
|
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3315-Seu", deviceJoinName: "Water Leak Sensor"
|
||||||
|
fingerprint inClusters: "0000,0001,0003,0020,0402,0500,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3315-L", deviceJoinName: "Iris Smart Water Sensor"
|
||||||
fingerprint inClusters: "0000,0001,0003,000F,0020,0402,0500", outClusters: "0019", manufacturer: "SmartThings", model: "moisturev4", deviceJoinName: "Water Leak Sensor"
|
fingerprint inClusters: "0000,0001,0003,000F,0020,0402,0500", outClusters: "0019", manufacturer: "SmartThings", model: "moisturev4", deviceJoinName: "Water Leak Sensor"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +129,7 @@ private Map parseCatchAllMessage(String description) {
|
|||||||
if (cluster.command == 0x07) {
|
if (cluster.command == 0x07) {
|
||||||
if (cluster.data[0] == 0x00){
|
if (cluster.data[0] == 0x00){
|
||||||
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
||||||
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
resultMap = [name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
@@ -285,8 +286,8 @@ def ping() {
|
|||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "Refreshing Temperature and Battery"
|
log.debug "Refreshing Temperature and Battery"
|
||||||
def refreshCmds = [
|
def refreshCmds = [
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 200",
|
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 2000",
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 200"
|
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 2000"
|
||||||
]
|
]
|
||||||
|
|
||||||
return refreshCmds + enrollResponse()
|
return refreshCmds + enrollResponse()
|
||||||
@@ -308,10 +309,10 @@ def enrollResponse() {
|
|||||||
[
|
[
|
||||||
//Resending the CIE in case the enroll request is sent before CIE is written
|
//Resending the CIE in case the enroll request is sent before CIE is written
|
||||||
"zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200",
|
"zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 2000",
|
||||||
//Enroll Response
|
//Enroll Response
|
||||||
"raw 0x500 {01 23 00 00 00}",
|
"raw 0x500 {01 23 00 00 00}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 1", "delay 200"
|
"send 0x${device.deviceNetworkId} 1 1", "delay 2000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ private Map parseCatchAllMessage(String description) {
|
|||||||
if (cluster.command == 0x07) {
|
if (cluster.command == 0x07) {
|
||||||
if (cluster.data[0] == 0x00) {
|
if (cluster.data[0] == 0x00) {
|
||||||
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
||||||
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
resultMap = [name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
@@ -298,8 +298,8 @@ def ping() {
|
|||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "refresh called"
|
log.debug "refresh called"
|
||||||
def refreshCmds = [
|
def refreshCmds = [
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 200",
|
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 2000",
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 200"
|
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 2000"
|
||||||
]
|
]
|
||||||
|
|
||||||
return refreshCmds + enrollResponse()
|
return refreshCmds + enrollResponse()
|
||||||
@@ -321,10 +321,10 @@ def enrollResponse() {
|
|||||||
[
|
[
|
||||||
//Resending the CIE in case the enroll request is sent before CIE is written
|
//Resending the CIE in case the enroll request is sent before CIE is written
|
||||||
"zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200",
|
"zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 2000",
|
||||||
//Enroll Response
|
//Enroll Response
|
||||||
"raw 0x500 {01 23 00 00 00}",
|
"raw 0x500 {01 23 00 00 00}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 1", "delay 200"
|
"send 0x${device.deviceNetworkId} 1 1", "delay 2000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ private Map parseCatchAllMessage(String description) {
|
|||||||
if (cluster.command == 0x07) {
|
if (cluster.command == 0x07) {
|
||||||
if(cluster.data[0] == 0x00) {
|
if(cluster.data[0] == 0x00) {
|
||||||
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
||||||
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
resultMap = [name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
@@ -339,7 +339,7 @@ private Map getContactResult(value) {
|
|||||||
log.debug "Contact: ${device.displayName} value = ${value}"
|
log.debug "Contact: ${device.displayName} value = ${value}"
|
||||||
def descriptionText = value == 'open' ? '{{ device.displayName }} was opened' : '{{ device.displayName }} was closed'
|
def descriptionText = value == 'open' ? '{{ device.displayName }} was opened' : '{{ device.displayName }} was closed'
|
||||||
sendEvent(name: 'contact', value: value, descriptionText: descriptionText, displayed: false, translatable: true)
|
sendEvent(name: 'contact', value: value, descriptionText: descriptionText, displayed: false, translatable: true)
|
||||||
sendEvent(name: 'status', value: value, descriptionText: descriptionText, translatable: true)
|
return [name: 'status', value: value, descriptionText: descriptionText, translatable: true]
|
||||||
}
|
}
|
||||||
|
|
||||||
private getAccelerationResult(numValue) {
|
private getAccelerationResult(numValue) {
|
||||||
@@ -428,10 +428,10 @@ def enrollResponse() {
|
|||||||
[
|
[
|
||||||
//Resending the CIE in case the enroll request is sent before CIE is written
|
//Resending the CIE in case the enroll request is sent before CIE is written
|
||||||
"zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200",
|
"zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 2000",
|
||||||
//Enroll Response
|
//Enroll Response
|
||||||
"raw 0x500 {01 23 00 00 00}", "delay 200",
|
"raw 0x500 {01 23 00 00 00}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 1", "delay 200"
|
"send 0x${device.deviceNetworkId} 1 1", "delay 2000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ private Map parseCatchAllMessage(String description) {
|
|||||||
if (cluster.command == 0x07){
|
if (cluster.command == 0x07){
|
||||||
if (cluster.data[0] == 0x00) {
|
if (cluster.data[0] == 0x00) {
|
||||||
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
||||||
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
resultMap = [name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
@@ -252,8 +252,8 @@ def ping() {
|
|||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "Refreshing Temperature and Battery"
|
log.debug "Refreshing Temperature and Battery"
|
||||||
def refreshCmds = [
|
def refreshCmds = [
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 200",
|
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 2000",
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 200"
|
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 2000"
|
||||||
]
|
]
|
||||||
|
|
||||||
return refreshCmds + enrollResponse()
|
return refreshCmds + enrollResponse()
|
||||||
@@ -277,10 +277,10 @@ def enrollResponse() {
|
|||||||
[
|
[
|
||||||
//Resending the CIE in case the enroll request is sent before CIE is written
|
//Resending the CIE in case the enroll request is sent before CIE is written
|
||||||
"zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200",
|
"zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 2000",
|
||||||
//Enroll Response
|
//Enroll Response
|
||||||
"raw 0x500 {01 23 00 00 00}",
|
"raw 0x500 {01 23 00 00 00}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 1", "delay 200"
|
"send 0x${device.deviceNetworkId} 1 1", "delay 2000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ private Map parseCatchAllMessage(String description) {
|
|||||||
if (cluster.command == 0x07) {
|
if (cluster.command == 0x07) {
|
||||||
if (cluster.data[0] == 0x00){
|
if (cluster.data[0] == 0x00){
|
||||||
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
||||||
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
resultMap = [name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
@@ -270,9 +270,9 @@ def configure() {
|
|||||||
|
|
||||||
log.debug "Configuring Reporting and Bindings."
|
log.debug "Configuring Reporting and Bindings."
|
||||||
def humidityConfigCmds = [
|
def humidityConfigCmds = [
|
||||||
"zdo bind 0x${device.deviceNetworkId} 1 1 0xFC45 {${device.zigbeeId}} {}", "delay 500",
|
"zdo bind 0x${device.deviceNetworkId} 1 1 0xFC45 {${device.zigbeeId}} {}", "delay 2000",
|
||||||
"zcl global send-me-a-report 0xFC45 0 0x29 30 3600 {6400}",
|
"zcl global send-me-a-report 0xFC45 0 0x29 30 3600 {6400}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 1", "delay 500"
|
"send 0x${device.deviceNetworkId} 1 1", "delay 2000"
|
||||||
]
|
]
|
||||||
|
|
||||||
// temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity
|
// temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ def parse(String description) {
|
|||||||
def bodyString = msg.body
|
def bodyString = msg.body
|
||||||
if (bodyString) {
|
if (bodyString) {
|
||||||
unschedule("setOffline")
|
unschedule("setOffline")
|
||||||
def body = new XmlSlurper().parseText(bodyString)
|
def body = new XmlSlurper().parseText(bodyString.replaceAll("[^\\x20-\\x7e]", ""))
|
||||||
|
|
||||||
if (body?.property?.TimeSyncRequest?.text()) {
|
if (body?.property?.TimeSyncRequest?.text()) {
|
||||||
log.trace "Got TimeSyncRequest"
|
log.trace "Got TimeSyncRequest"
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ def parse(String description) {
|
|||||||
def bodyString = msg.body
|
def bodyString = msg.body
|
||||||
if (bodyString) {
|
if (bodyString) {
|
||||||
unschedule("setOffline")
|
unschedule("setOffline")
|
||||||
def body = new XmlSlurper().parseText(bodyString)
|
def body = new XmlSlurper().parseText(bodyString.replaceAll("[^\\x20-\\x7e]", ""))
|
||||||
if (body?.property?.TimeSyncRequest?.text()) {
|
if (body?.property?.TimeSyncRequest?.text()) {
|
||||||
log.trace "Got TimeSyncRequest"
|
log.trace "Got TimeSyncRequest"
|
||||||
result << timeSyncResponse()
|
result << timeSyncResponse()
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ def parse(String description) {
|
|||||||
def bodyString = msg.body
|
def bodyString = msg.body
|
||||||
if (bodyString) {
|
if (bodyString) {
|
||||||
unschedule("setOffline")
|
unschedule("setOffline")
|
||||||
def body = new XmlSlurper().parseText(bodyString)
|
def body = new XmlSlurper().parseText(bodyString.replaceAll("[^\\x20-\\x7e]", ""))
|
||||||
if (body?.property?.TimeSyncRequest?.text()) {
|
if (body?.property?.TimeSyncRequest?.text()) {
|
||||||
log.trace "Got TimeSyncRequest"
|
log.trace "Got TimeSyncRequest"
|
||||||
result << timeSyncResponse()
|
result << timeSyncResponse()
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ metadata {
|
|||||||
|
|
||||||
fingerprint inClusters: "0000, 0001, 0003, 0020, 0402, 0B05", outClusters: "0003, 0006, 0008, 0019", manufacturer: "OSRAM", model: "LIGHTIFY Dimming Switch", deviceJoinName: "OSRAM LIGHTIFY Dimming Switch"
|
fingerprint inClusters: "0000, 0001, 0003, 0020, 0402, 0B05", outClusters: "0003, 0006, 0008, 0019", manufacturer: "OSRAM", model: "LIGHTIFY Dimming Switch", deviceJoinName: "OSRAM LIGHTIFY Dimming Switch"
|
||||||
//fingerprint inClusters: "0000, 0001, 0003, 0020, 0500", outClusters: "0003,0019", manufacturer: "CentraLite", model: "3455-L", deviceJoinName: "Iris Care Pendant"
|
//fingerprint inClusters: "0000, 0001, 0003, 0020, 0500", outClusters: "0003,0019", manufacturer: "CentraLite", model: "3455-L", deviceJoinName: "Iris Care Pendant"
|
||||||
//fingerprint inClusters: "0000, 0001, 0003, 0007, 0020, 0402, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model: "3460-L", deviceJoinName: "Iris Smart Button"
|
fingerprint inClusters: "0000, 0001, 0003, 0007, 0020, 0402, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model: "3460-L", deviceJoinName: "Iris Smart Button"
|
||||||
//fingerprint inClusters: "0000, 0001, 0003, 0007, 0020, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model:"3450-L", deviceJoinName: "Iris KeyFob"
|
fingerprint inClusters: "0000, 0001, 0003, 0007, 0020, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model:"3450-L", deviceJoinName: "Iris KeyFob"
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {}
|
simulator {}
|
||||||
|
|||||||
@@ -23,9 +23,11 @@ metadata {
|
|||||||
|
|
||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 ON/OFF/DIM", deviceJoinName: "OSRAM LIGHTIFY LED Smart Connected Light"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart A19 Soft White"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FF00", outClusters: "0019", manufacturer: "MRVL", model: "MZ100", deviceJoinName: "Wemo Bulb"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FF00", outClusters: "0019", manufacturer: "MRVL", model: "MZ100", deviceJoinName: "Wemo Bulb"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B05", outClusters: "0019", manufacturer: "OSRAM SYLVANIA", model: "iQBR30", deviceJoinName: "Sylvania Ultra iQ"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B05", outClusters: "0019", manufacturer: "OSRAM SYLVANIA", model: "iQBR30", deviceJoinName: "Sylvania Ultra iQ"
|
||||||
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY PAR38 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart PAR38 Soft White"
|
||||||
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart BR30 Soft White"
|
||||||
}
|
}
|
||||||
|
|
||||||
tiles(scale: 2) {
|
tiles(scale: 2) {
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ metadata {
|
|||||||
capability "Switch Level"
|
capability "Switch Level"
|
||||||
capability "Health Check"
|
capability "Health Check"
|
||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Gardenspot RGB", deviceJoinName: "OSRAM LIGHTIFY Gardenspot mini RGB"
|
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Gardenspot RGB", deviceJoinName: "SYLVANIA Smart Gardenspot mini RGB"
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY Gardenspot RGB", deviceJoinName: "OSRAM LIGHTIFY Gardenspot mini RGB"
|
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY Gardenspot RGB", deviceJoinName: "SYLVANIA Smart Gardenspot mini RGB"
|
||||||
}
|
}
|
||||||
|
|
||||||
// UI tile definitions
|
// UI tile definitions
|
||||||
|
|||||||
@@ -32,11 +32,12 @@ metadata {
|
|||||||
attribute "colorName", "string"
|
attribute "colorName", "string"
|
||||||
command "setGenericName"
|
command "setGenericName"
|
||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY Flex RGBW", deviceJoinName: "OSRAM LIGHTIFY LED FLEXIBLE STRIP RGBW"
|
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY Flex RGBW", deviceJoinName: "SYLVANIA Smart Flex RGBW"
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Flex RGBW", deviceJoinName: "OSRAM LIGHTIFY LED FLEXIBLE STRIP RGBW"
|
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Flex RGBW", deviceJoinName: "OSRAM LIGHTIFY Flex RGBW"
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 RGBW", deviceJoinName: "OSRAM LIGHTIFY LED A19 RGBW"
|
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 RGBW", deviceJoinName: "SYLVANIA Smart A19 RGBW"
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR RGBW", deviceJoinName: "OSRAM LIGHTIFY LED BR30 RGBW"
|
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR RGBW", deviceJoinName: "SYLVANIA Smart BR30 RGBW"
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY RT RGBW", deviceJoinName: "OSRAM LIGHTIFY LED RT 5/6 RGBW"
|
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY RT RGBW", deviceJoinName: "SYLVANIA Smart RT5/6 RGBW"
|
||||||
|
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY FLEX OUTDOOR RGBW", deviceJoinName: "SYLVANIA Smart Outdoor RGBW Flex"
|
||||||
}
|
}
|
||||||
|
|
||||||
// UI tile definitions
|
// UI tile definitions
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ 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: "SYLVANIA Smart 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 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: "LIGHTIFY RT Tunable White", deviceJoinName: "SYLVANIA Smart RT5/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 Classic A60 Tunable White"
|
||||||
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: "SYLVANIA Smart A19 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"
|
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, 0702, 0B05", outClusters: "0019", manufacturer: "sengled", model: "Z01-A19NAE26", deviceJoinName: "Sengled Element plus"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0702, 0B05", outClusters: "0019", manufacturer: "sengled", model: "Z01-A19NAE26", deviceJoinName: "Sengled Element plus"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ def configureHealthCheck() {
|
|||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
log.debug "configure()"
|
log.debug "configure()"
|
||||||
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh()
|
|
||||||
configureHealthCheck()
|
configureHealthCheck()
|
||||||
|
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ metadata {
|
|||||||
fingerprint inClusters: "0x26", deviceJoinName: "Z-Wave Dimmer"
|
fingerprint inClusters: "0x26", deviceJoinName: "Z-Wave Dimmer"
|
||||||
fingerprint mfr:"001D", prod:"1902", deviceJoinName: "Z-Wave Dimmer"
|
fingerprint mfr:"001D", prod:"1902", deviceJoinName: "Z-Wave Dimmer"
|
||||||
fingerprint mfr:"001D", prod:"1B03", model:"0334", deviceJoinName: "Leviton Universal Dimmer"
|
fingerprint mfr:"001D", prod:"1B03", model:"0334", deviceJoinName: "Leviton Universal Dimmer"
|
||||||
|
fingerprint mfr:"011A", prod:"0102", model:"0201", deviceJoinName: "Enerwave In-Wall Dimmer"
|
||||||
|
fingerprint mfr:"001D", prod:"1001", model:"0334", deviceJoinName: "Leviton 3-Speed Fan Controller"
|
||||||
|
fingerprint mfr:"001D", prod:"0602", model:"0334", deviceJoinName: "Leviton Magnetic Low Voltage Dimmer"
|
||||||
|
fingerprint mfr:"001D", prod:"0401", model:"0334", deviceJoinName: "Leviton 600W Incandescent Dimmer"
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ metadata {
|
|||||||
fingerprint mfr: "0060", prod: "0001", model: "0002", deviceJoinName: "Everspring Motion Sensor" // Everspring SP814
|
fingerprint mfr: "0060", prod: "0001", model: "0002", deviceJoinName: "Everspring Motion Sensor" // Everspring SP814
|
||||||
fingerprint mfr: "0060", prod: "0001", model: "0003", deviceJoinName: "Everspring Motion Sensor" // Everspring HSP02
|
fingerprint mfr: "0060", prod: "0001", model: "0003", deviceJoinName: "Everspring Motion Sensor" // Everspring HSP02
|
||||||
fingerprint mfr: "011A", prod: "0601", model: "0901", deviceJoinName: "Enerwave Motion Sensor" // Enerwave ZWN-BPC
|
fingerprint mfr: "011A", prod: "0601", model: "0901", deviceJoinName: "Enerwave Motion Sensor" // Enerwave ZWN-BPC
|
||||||
|
fingerprint mfr: "0063", prod: "4953", model: "3133", deviceJoinName: "GE Smart Motion Sensor"
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ metadata {
|
|||||||
fingerprint mfr:"0063", prod:"4F50", model:"3031", deviceJoinName: "GE Plug-in Outdoor Switch"
|
fingerprint mfr:"0063", prod:"4F50", model:"3031", deviceJoinName: "GE Plug-in Outdoor Switch"
|
||||||
fingerprint mfr:"001D", prod:"1D04", model:"0334", deviceJoinName: "Leviton Outlet"
|
fingerprint mfr:"001D", prod:"1D04", model:"0334", deviceJoinName: "Leviton Outlet"
|
||||||
fingerprint mfr:"001D", prod:"1C02", model:"0334", deviceJoinName: "Leviton Switch"
|
fingerprint mfr:"001D", prod:"1C02", model:"0334", deviceJoinName: "Leviton Switch"
|
||||||
|
fingerprint mfr:"001D", prod:"0301", model:"0334", deviceJoinName: "Leviton 15A Switch"
|
||||||
|
fingerprint mfr:"011A", prod:"0101", model:"0102", deviceJoinName: "Enerwave On/Off Switch"
|
||||||
|
fingerprint mfr:"011A", prod:"0101", model:"0603", deviceJoinName: "Enerwave Duplex Receptacle"
|
||||||
}
|
}
|
||||||
|
|
||||||
// simulator metadata
|
// simulator metadata
|
||||||
|
|||||||
@@ -16,33 +16,55 @@
|
|||||||
definition(
|
definition(
|
||||||
name: "Gideon",
|
name: "Gideon",
|
||||||
namespace: "gideon.api",
|
namespace: "gideon.api",
|
||||||
author: "Braindrain Solutions",
|
author: "Braindrain Solutions ltd",
|
||||||
description: "Gideon AI Smart app allows you to connect and control all of your SmartThings devices through the Gideon AI app, making your SmartThings devices even smarter.",
|
description: "Gideon Smart Home SmartApp allows you to connect and control all of your SmartThings devices through the Gideon app, making your SmartThings devices even smarter.",
|
||||||
category: "Family",
|
category: "Family",
|
||||||
iconUrl: "http://s33.postimg.org/t77u7y7v3/logo.png",
|
iconUrl: "http://s33.postimg.org/t77u7y7v3/logo.png",
|
||||||
iconX2Url: "http://s33.postimg.org/t77u7y7v3/logo.png",
|
iconX2Url: "http://s33.postimg.org/t77u7y7v3/logo.png",
|
||||||
iconX3Url: "http://s33.postimg.org/t77u7y7v3/logo.png",
|
iconX3Url: "http://s33.postimg.org/t77u7y7v3/logo.png",
|
||||||
oauth: [displayName: "Gideon AI API", displayLink: "gideon.ai"])
|
oauth: [displayName: "Gideon Smart Home API app", displayLink: "gideon.ai"])
|
||||||
|
|
||||||
|
|
||||||
preferences {
|
preferences {
|
||||||
|
section("Control these contact sensors...") {
|
||||||
|
input "contact", "capability.contactSensor", multiple:true, required:false
|
||||||
|
}
|
||||||
section("Control these switches...") {
|
section("Control these switches...") {
|
||||||
input "switches", "capability.switch", multiple:true
|
input "switches", "capability.switch", multiple:true, required:false
|
||||||
|
}
|
||||||
|
section("Control these smoke alarms...") {
|
||||||
|
input "smoke_alarms", "capability.smokeDetector", multiple:true, required:false
|
||||||
|
}
|
||||||
|
section("Control these window shades...") {
|
||||||
|
input "shades", "capability.windowShade", multiple:true, required:false
|
||||||
|
}
|
||||||
|
section("Control these garage doors...") {
|
||||||
|
input "garage", "capability.garageDoorControl", multiple:true, required:false
|
||||||
|
}
|
||||||
|
section("Control these water sensors...") {
|
||||||
|
input "water_sensors", "capability.waterSensor", multiple:true, required:false
|
||||||
}
|
}
|
||||||
section("Control these motion sensors...") {
|
section("Control these motion sensors...") {
|
||||||
input "motions", "capability.motionSensor", multiple:true
|
input "motions", "capability.motionSensor", multiple:true, required:false
|
||||||
}
|
}
|
||||||
section("Control these presence sensors...") {
|
section("Control these presence sensors...") {
|
||||||
input "presence_sensors", "capability.presenceSensor", multiple:true
|
input "presence_sensors", "capability.presenceSensor", multiple:true, required:false
|
||||||
}
|
}
|
||||||
section("Control these outlets...") {
|
/** section("Control these outlets...") {
|
||||||
input "outlets", "capability.switch", multiple:true
|
input "outlets", "capability.switch", multiple:true, required:false
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
section("Control these power meters...") {
|
||||||
|
input "meters", "capability.powerMeter", multiple:true, required:false
|
||||||
}
|
}
|
||||||
section("Control these locks...") {
|
section("Control these locks...") {
|
||||||
input "locks", "capability.lock", multiple:true
|
input "locks", "capability.lock", multiple:true, required:false
|
||||||
}
|
}
|
||||||
section("Control these locks...") {
|
section("Control these temperature sensors...") {
|
||||||
input "temperature_sensors", "capability.temperatureMeasurement"
|
input "temperature_sensors", "capability.temperatureMeasurement", multiple:true, required:false
|
||||||
|
}
|
||||||
|
section("Control these batteries...") {
|
||||||
|
input "batteries", "capability.battery", multiple:true, required:false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,43 +82,98 @@ def updated() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def initialize() {
|
def initialize() {
|
||||||
// TODO: subscribe to attributes, devices, locations, etc.
|
|
||||||
subscribe(outlet, "energy", outletHandler)
|
|
||||||
subscribe(outlet, "switch", outletHandler)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: implement event handlers
|
|
||||||
def outletHandler(evt) {
|
|
||||||
log.debug "$outlet.currentEnergy"
|
|
||||||
//TODO call G API
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private device(it, type) {
|
private device(it, type) {
|
||||||
it ? [id: it.id, label: it.label, type: type] : null
|
it ? [id: it.id, label: it.label, type: type] : null
|
||||||
}
|
}
|
||||||
|
|
||||||
//API Mapping
|
//API Mapping
|
||||||
mappings {
|
mappings {
|
||||||
path("/getalldevices") {
|
path("/getalldevices") {
|
||||||
action: [
|
action: [
|
||||||
GET: "getAllDevices"
|
GET: "getAllDevices"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/doorlocks/:id/:command") {
|
path("/doorlocks/lock/:id") {
|
||||||
action: [
|
action: [
|
||||||
GET: "updateDoorLock"
|
GET: "lockDoorLock"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/doorlocks/:id") {
|
path("/doorlocks/unlock/:id") {
|
||||||
action: [
|
action: [
|
||||||
GET: "getDoorLockStatus"
|
GET: "unlockDoorLock"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/doorlocks/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "getDoorLockStatus"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/contacts/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "getContactStatus"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/smoke/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "getSmokeStatus"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/shades/open/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "openShade"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/shades/preset/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "presetShade"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/shades/close/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "closeShade"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/shades/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "getShadeStatus"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/garage/open/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "openGarage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/garage/close/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "closeGarage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/garage/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "getGarageStatus"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/watersensors/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "getWaterSensorStatus"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/tempsensors/:id") {
|
path("/tempsensors/:id") {
|
||||||
action: [
|
action: [
|
||||||
GET: "getTempSensorsStatus"
|
GET: "getTempSensorsStatus"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
path("/meters/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "getMeterStatus"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/batteries/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "getBatteryStatus"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
path("/presences/:id") {
|
path("/presences/:id") {
|
||||||
action: [
|
action: [
|
||||||
@@ -108,19 +185,35 @@ mappings {
|
|||||||
GET: "getMotionStatus"
|
GET: "getMotionStatus"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/outlets/:id") {
|
/** path("/outlets/:id") {
|
||||||
action: [
|
action: [
|
||||||
GET: "getOutletStatus"
|
GET: "getOutletStatus"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/outlets/:id/:command") {
|
path("/outlets/turnon/:id") {
|
||||||
action: [
|
action: [
|
||||||
GET: "updateOutlet"
|
GET: "turnOnOutlet"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/switches/:command") {
|
path("/outlets/turnoff/:id") {
|
||||||
action: [
|
action: [
|
||||||
PUT: "updateSwitch"
|
GET: "turnOffOutlet"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
path("/switches/turnon/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "turnOnSwitch"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/switches/turnoff/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "turnOffSwitch"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/switches/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "getSwitchStatus"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,12 +221,149 @@ mappings {
|
|||||||
//API Methods
|
//API Methods
|
||||||
def getAllDevices() {
|
def getAllDevices() {
|
||||||
def locks_list = locks.collect{device(it,"Lock")}
|
def locks_list = locks.collect{device(it,"Lock")}
|
||||||
|
def contact_list = contact.collect{device(it,"Contact Sensor")}
|
||||||
|
def smokes_list = smoke_alarms.collect{device(it,"Smoke Alarm")}
|
||||||
|
def shades_list = shades.collect{device(it,"Window Shade")}
|
||||||
|
def garage_list = garage.collect{device(it,"Garage Door")}
|
||||||
|
def water_sensors_list = water_sensors.collect{device(it,"Water Sensor")}
|
||||||
def presences_list = presence_sensors.collect{device(it,"Presence")}
|
def presences_list = presence_sensors.collect{device(it,"Presence")}
|
||||||
def motions_list = motions.collect{device(it,"Motion")}
|
def motions_list = motions.collect{device(it,"Motion")}
|
||||||
def outlets_list = outlets.collect{device(it,"Outlet")}
|
/** def outlets_list = outlets.collect{device(it,"Outlet")} */
|
||||||
def switches_list = switches.collect{device(it,"Switch")}
|
def switches_list = switches.collect{device(it,"Switch")}
|
||||||
def temp_list = temperature_sensors.collect{device(it,"Temperature")}
|
def temp_list = temperature_sensors.collect{device(it,"Temperature")}
|
||||||
return [Locks: locks_list, Presences: presences_list, Motions: motions_list, Outlets: outlets_list, Switches: switches_list, Temperatures: temp_list]
|
def meters_list = meters.collect{device(it,"Power Meters")}
|
||||||
|
def battery_list = batteries.collect{device(it,"Batteries")}
|
||||||
|
return smokes_list + contact_list + water_sensors_list + shades_list + garage_list + locks_list + presences_list + motions_list + switches_list + temp_list + meters_list + battery_list
|
||||||
|
}
|
||||||
|
|
||||||
|
//contact sensors
|
||||||
|
def getContactStatus() {
|
||||||
|
def device = contact.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
def args = getTempSensorsStatus(device.id)
|
||||||
|
return [Device_state: device.currentValue('contact')] + args
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//smoke detectors
|
||||||
|
def getSmokeStatus() {
|
||||||
|
def device = smoke_alarms.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
def bat = getBatteryStatus(device.id)
|
||||||
|
return [Device_state: device.currentValue('smoke')] + bat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//garage
|
||||||
|
def getGarageStatus() {
|
||||||
|
def device = garage.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
return [Device_state: device.currentValue('door')]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def openGarage() {
|
||||||
|
def device = garage.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
device.open();
|
||||||
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def closeGarage() {
|
||||||
|
def device = garage.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
device.close();
|
||||||
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//shades
|
||||||
|
def getShadeStatus() {
|
||||||
|
def device = shades.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
return [Device_state: device.currentValue('windowShade')]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def openShade() {
|
||||||
|
def device = shades.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
device.open();
|
||||||
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def presetShade() {
|
||||||
|
def device = shades.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
device.presetPosition();
|
||||||
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def closeShade() {
|
||||||
|
def device = shades.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
device.close();
|
||||||
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//water sensor
|
||||||
|
def getWaterSensorStatus() {
|
||||||
|
def device = water_sensors.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
def bat = getBatteryStatus(device.id)
|
||||||
|
return [Device_state: device.currentValue('water')] + bat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//batteries
|
||||||
|
def getBatteryStatus() {
|
||||||
|
def device = batteries.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
return [Device_state: device.latestValue("battery")]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getBatteryStatus(id) {
|
||||||
|
def device = batteries.find { it.id == id }
|
||||||
|
if (!device) {
|
||||||
|
return []
|
||||||
|
} else {
|
||||||
|
return [battery_state: device.latestValue("battery")]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//LOCKS
|
//LOCKS
|
||||||
@@ -142,30 +372,34 @@ def getDoorLockStatus() {
|
|||||||
if (!device) {
|
if (!device) {
|
||||||
httpError(404, "Device not found")
|
httpError(404, "Device not found")
|
||||||
} else {
|
} else {
|
||||||
return [Device_state: device.currentValue('lock')]
|
def bat = getBatteryStatus(device.id)
|
||||||
|
return [Device_state: device.currentValue('lock')] + bat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def updateDoorLock() {
|
def lockDoorLock() {
|
||||||
def command = params.command
|
|
||||||
def device = locks.find { it.id == params.id }
|
def device = locks.find { it.id == params.id }
|
||||||
if (command){
|
if (!device) {
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
httpError(404, "Device not found")
|
||||||
} else {
|
} else {
|
||||||
if(command == "toggle")
|
|
||||||
{
|
|
||||||
if(device.currentValue('lock') == "locked")
|
|
||||||
device.unlock();
|
|
||||||
else
|
|
||||||
device.lock();
|
|
||||||
|
|
||||||
return [Device_id: params.id, result_action: "200"]
|
device.lock();
|
||||||
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
def unlockDoorLock() {
|
||||||
|
def device = locks.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
device.unlock();
|
||||||
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
|
}
|
||||||
|
}
|
||||||
//PRESENCE
|
//PRESENCE
|
||||||
def getPresenceStatus() {
|
def getPresenceStatus() {
|
||||||
|
|
||||||
@@ -173,7 +407,8 @@ def getPresenceStatus() {
|
|||||||
if (!device) {
|
if (!device) {
|
||||||
httpError(404, "Device not found")
|
httpError(404, "Device not found")
|
||||||
} else {
|
} else {
|
||||||
return [Device_state: device.currentValue('presence')]
|
def bat = getBatteryStatus(device.id)
|
||||||
|
return [Device_state: device.currentValue('presence')] + bat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,63 +419,111 @@ def getMotionStatus() {
|
|||||||
if (!device) {
|
if (!device) {
|
||||||
httpError(404, "Device not found")
|
httpError(404, "Device not found")
|
||||||
} else {
|
} else {
|
||||||
return [Device_state: device.currentValue('motion')]
|
def args = getTempSensorsStatus(device.id)
|
||||||
|
return [Device_state: device.currentValue('motion')] + args
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//OUTLET
|
//OUTLET
|
||||||
|
/**
|
||||||
def getOutletStatus() {
|
def getOutletStatus() {
|
||||||
|
|
||||||
def device = outlets.find { it.id == params.id }
|
def device = outlets.find { it.id == params.id }
|
||||||
if (!device) {
|
if (!device) {
|
||||||
httpError(404, "Device not found")
|
httpError(404, "Device not found")
|
||||||
} else {
|
} else {
|
||||||
return [Device_state: device.currentSwitch, Current_watt: device.currentValue("energy")]
|
def watt = getMeterStatus(device.id)
|
||||||
|
return [Device_state: device.currentSwitch] + watt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
def getMeterStatus() {
|
||||||
|
|
||||||
|
def device = meters.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
return [Device_id: device.id, Device_type: device.type, Current_watt: device.currentValue("power")]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def updateOutlet() {
|
def getMeterStatus(id) {
|
||||||
|
|
||||||
def command = params.command
|
def device = meters.find { it.id == id }
|
||||||
|
if (!device) {
|
||||||
|
return []
|
||||||
|
} else {
|
||||||
|
return [Current_watt: device.currentValue("power")]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
def turnOnOutlet() {
|
||||||
def device = outlets.find { it.id == params.id }
|
def device = outlets.find { it.id == params.id }
|
||||||
if (command){
|
if (command){
|
||||||
if (!device) {
|
if (!device) {
|
||||||
httpError(404, "Device not found")
|
httpError(404, "Device not found")
|
||||||
} else {
|
} else {
|
||||||
if(command == "toggle")
|
|
||||||
{
|
|
||||||
if(device.currentSwitch == "on")
|
|
||||||
device.off();
|
|
||||||
else
|
|
||||||
device.on();
|
|
||||||
|
|
||||||
return [Device_id: params.id, result_action: "200"]
|
device.on();
|
||||||
}
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
def turnOffOutlet() {
|
||||||
|
def device = outlets.find { it.id == params.id }
|
||||||
|
if (command){
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
device.off();
|
||||||
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
//SWITCH
|
//SWITCH
|
||||||
def updateSwitch() {
|
def getSwitchStatus() {
|
||||||
def command = params.command
|
def device = switches.find { it.id == params.id }
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
return [Device_state: device.currentValue('switch')]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def turnOnSwitch() {
|
||||||
def device = switches.find { it.id == params.id }
|
def device = switches.find { it.id == params.id }
|
||||||
if (command){
|
if (command){
|
||||||
if (!device) {
|
if (!device) {
|
||||||
httpError(404, "Device not found")
|
httpError(404, "Device not found")
|
||||||
} else {
|
} else {
|
||||||
if(command == "toggle")
|
|
||||||
{
|
|
||||||
if(device.currentSwitch == "on")
|
|
||||||
device.off();
|
|
||||||
else
|
|
||||||
device.on();
|
|
||||||
|
|
||||||
return [Device_id: params.id, result_action: "200"]
|
device.on();
|
||||||
}
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def turnOffSwitch() {
|
||||||
|
def device = switches.find { it.id == params.id }
|
||||||
|
if (command){
|
||||||
|
if (!device) {
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
device.on();
|
||||||
|
|
||||||
|
return [Device_id: params.id, result_action: "200"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//TEMPERATURE
|
//TEMPERATURE
|
||||||
def getTempSensorsStatus() {
|
def getTempSensorsStatus() {
|
||||||
|
|
||||||
@@ -248,6 +531,17 @@ def getTempSensorsStatus() {
|
|||||||
if (!device) {
|
if (!device) {
|
||||||
httpError(404, "Device not found")
|
httpError(404, "Device not found")
|
||||||
} else {
|
} else {
|
||||||
return [Device_state: device.currentValue('temperature')]
|
def bat = getBatteryStatus(device.id)
|
||||||
|
return [Device_state: device.currentValue('temperature')] + bat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getTempSensorsStatus(id) {
|
||||||
|
def device = temperature_sensors.find { it.id == id }
|
||||||
|
if (!device) {
|
||||||
|
return []
|
||||||
|
} else {
|
||||||
|
def bat = getBatteryStatus(device.id)
|
||||||
|
return [temperature: device.currentValue('temperature')] + bat
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Color Coordinator
|
* Color Coordinator
|
||||||
* Version 1.1.0 - 11/9/16
|
* Version 1.1.1 - 11/9/16
|
||||||
* 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.
|
* 1.1.0 - Fixed issue where master can be part of slaves. This causes a loop that impacts SmartThings.
|
||||||
|
* 1.1.1 - Fix NPE being thrown for slave/master inputs being empty.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -33,17 +34,17 @@ preferences {
|
|||||||
|
|
||||||
def mainPage() {
|
def mainPage() {
|
||||||
dynamicPage(name: "mainPage", title: "", install: true, uninstall: false) {
|
dynamicPage(name: "mainPage", title: "", install: true, uninstall: false) {
|
||||||
def masterInList = slaves.id.find{it==master.id}
|
def masterInList = slaves?.id?.find{it==master?.id}
|
||||||
if (masterInList) {
|
if (masterInList) {
|
||||||
section ("**WARNING**"){
|
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"
|
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") {
|
section("Master Light") {
|
||||||
input "master", "capability.colorControl", title: "Colored Light"
|
input "master", "capability.colorControl", title: "Colored Light", required: true
|
||||||
}
|
}
|
||||||
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: true, submitOnChange: true
|
||||||
}
|
}
|
||||||
section([mobileOnly:true], "Options") {
|
section([mobileOnly:true], "Options") {
|
||||||
input "randomYes", "bool",title: "When Master Turned On, Randomize Color", defaultValue: false
|
input "randomYes", "bool",title: "When Master Turned On, Randomize Color", defaultValue: false
|
||||||
@@ -81,40 +82,44 @@ def init() {
|
|||||||
}
|
}
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
def onOffHandler(evt){
|
def onOffHandler(evt){
|
||||||
if (!slaves.id.find{it==master.id}){
|
if (slaves && master) {
|
||||||
if (master.currentValue("switch") == "on"){
|
if (!slaves?.id.find{it==master?.id}){
|
||||||
if (randomYes) getRandomColorMaster()
|
if (master?.currentValue("switch") == "on"){
|
||||||
else 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"){
|
if (slaves && master) {
|
||||||
log.debug "Changing Slave units H,S,L"
|
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 newValue = [hue: hueLevel, saturation: saturationLevel, level: dimLevel as Integer]
|
def saturationLevel = master.currentValue("saturation")
|
||||||
slaves?.setColor(newValue)
|
def newValue = [hue: hueLevel, saturation: saturationLevel, level: dimLevel as Integer]
|
||||||
try {
|
slaves?.setColor(newValue)
|
||||||
log.debug "Changing Slave color temp"
|
try {
|
||||||
def tempLevel = master.currentValue("colorTemperature")
|
log.debug "Changing Slave color temp"
|
||||||
slaves?.setColorTemperature(tempLevel)
|
def tempLevel = master?.currentValue("colorTemperature")
|
||||||
}
|
slaves?.setColorTemperature(tempLevel)
|
||||||
catch (e){
|
}
|
||||||
log.debug "Color temp for master --"
|
catch (e){
|
||||||
}
|
log.debug "Color temp for master --"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getRandomColorMaster(){
|
def getRandomColorMaster(){
|
||||||
def hueLevel = Math.floor(Math.random() *1000)
|
def hueLevel = Math.floor(Math.random() *1000)
|
||||||
def saturationLevel = Math.floor(Math.random() * 100)
|
def saturationLevel = Math.floor(Math.random() * 100)
|
||||||
def dimLevel = master.currentValue("level")
|
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 hueLevel
|
||||||
log.debug saturationLevel
|
log.debug saturationLevel
|
||||||
@@ -123,12 +128,14 @@ def getRandomColorMaster(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
def tempHandler(evt){
|
def tempHandler(evt){
|
||||||
if (!slaves.id.find{it==master.id} && master.currentValue("switch") == "on"){
|
if (slaves && master) {
|
||||||
if (evt.value != "--") {
|
if (!slaves?.id?.find{it==master?.id} && master?.currentValue("switch") == "on"){
|
||||||
log.debug "Changing Slave color temp based on Master change"
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +146,7 @@ private def textAppName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def textVersion() {
|
private def textVersion() {
|
||||||
def text = "Version 1.1.0 (11/09/2016)"
|
def text = "Version 1.1.1 (12/13/2016)"
|
||||||
}
|
}
|
||||||
|
|
||||||
private def textCopyright() {
|
private def textCopyright() {
|
||||||
|
|||||||
@@ -289,12 +289,12 @@ def initializeLife360Connection() {
|
|||||||
state.life360AccessToken = result.data.access_token
|
state.life360AccessToken = result.data.access_token
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
log.debug "Response=${result.data}"
|
log.info "Life360 initializeLife360Connection, response=${result.data}"
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
log.debug e
|
log.error "Life360 initializeLife360Connection, error: $e"
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,7 +656,7 @@ def generateInitialEvent (member, childDevice) {
|
|||||||
|
|
||||||
try { // we are going to just ignore any errors
|
try { // we are going to just ignore any errors
|
||||||
|
|
||||||
log.debug "Generate Initial Event for New Device for Member = ${member.id}"
|
log.info "Life360 generateInitialEvent($member, $childDevice)"
|
||||||
|
|
||||||
def place = state.places.find{it.id==settings.place}
|
def place = state.places.find{it.id==settings.place}
|
||||||
|
|
||||||
@@ -678,6 +678,8 @@ def generateInitialEvent (member, childDevice) {
|
|||||||
|
|
||||||
boolean isPresent = (distanceAway <= placeRadius)
|
boolean isPresent = (distanceAway <= placeRadius)
|
||||||
|
|
||||||
|
log.info "Life360 generateInitialEvent, member: ($memberLatitude, $memberLongitude), place: ($placeLatitude, $placeLongitude), radius: $placeRadius, dist: $distanceAway, present: $isPresent"
|
||||||
|
|
||||||
// log.debug "External Id=${app.id}:${member.id}"
|
// log.debug "External Id=${app.id}:${member.id}"
|
||||||
|
|
||||||
// def childDevice2 = getChildDevice("${app.id}.${member.id}")
|
// def childDevice2 = getChildDevice("${app.id}.${member.id}")
|
||||||
@@ -718,7 +720,7 @@ def haversine(lat1, lon1, lat2, lon2) {
|
|||||||
|
|
||||||
def placeEventHandler() {
|
def placeEventHandler() {
|
||||||
|
|
||||||
log.debug "In placeEventHandler method."
|
log.info "Life360 placeEventHandler: params=$params, settings.place=$settings.place"
|
||||||
|
|
||||||
// the POST to this end-point will look like:
|
// the POST to this end-point will look like:
|
||||||
// POST http://test.com/webhook?circleId=XXXX&placeId=XXXX&userId=XXXX&direction=arrive
|
// POST http://test.com/webhook?circleId=XXXX&placeId=XXXX&userId=XXXX&direction=arrive
|
||||||
@@ -729,8 +731,6 @@ def placeEventHandler() {
|
|||||||
def direction = params?.direction
|
def direction = params?.direction
|
||||||
def timestamp = params?.timestamp
|
def timestamp = params?.timestamp
|
||||||
|
|
||||||
log.debug "Life360 Event: Circle: ${circleId}, Place: ${placeId}, User: ${userId}, Direction: ${direction}"
|
|
||||||
|
|
||||||
if (placeId == settings.place) {
|
if (placeId == settings.place) {
|
||||||
|
|
||||||
def presenceState = (direction=="in")
|
def presenceState = (direction=="in")
|
||||||
@@ -745,10 +745,10 @@ def placeEventHandler() {
|
|||||||
|
|
||||||
if (deviceWrapper) {
|
if (deviceWrapper) {
|
||||||
deviceWrapper.generatePresenceEvent(presenceState)
|
deviceWrapper.generatePresenceEvent(presenceState)
|
||||||
log.debug "Event raised on child device: ${externalId}"
|
log.debug "Life360 event raised on child device: ${externalId}"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.debug "Couldn't find child device associated with inbound Life360 event."
|
log.warn "Life360 couldn't find child device associated with inbound Life360 event."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user