mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-09 05:11:52 +00:00
Compare commits
12 Commits
MSA-1643-1
...
PROD_2017.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a17971d68c | ||
|
|
076ffecd19 | ||
|
|
8db0556696 | ||
|
|
490ec329cb | ||
|
|
3109049122 | ||
|
|
930c4ed914 | ||
|
|
259516f21f | ||
|
|
b7a08a88e0 | ||
|
|
76e139153a | ||
|
|
a4bc248006 | ||
|
|
e7eb461b4e | ||
|
|
083ed7cc9a |
@@ -99,7 +99,7 @@ def parse(String description) {
|
||||
|
||||
def poll() {
|
||||
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()
|
||||
@@ -197,7 +197,7 @@ def off() {
|
||||
|
||||
def refresh() {
|
||||
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()
|
||||
|
||||
@@ -128,9 +128,9 @@ def setLevel(value) {
|
||||
|
||||
def refresh() {
|
||||
[
|
||||
"st rattr 0x${device.deviceNetworkId} ${endpointId} 6 0", "delay 500",
|
||||
"st rattr 0x${device.deviceNetworkId} ${endpointId} 8 0", "delay 500",
|
||||
"st rattr 0x${device.deviceNetworkId} ${endpointId} 0x0B04 0x050B", "delay 500"
|
||||
"st rattr 0x${device.deviceNetworkId} ${endpointId} 6 0", "delay 2000",
|
||||
"st rattr 0x${device.deviceNetworkId} ${endpointId} 8 0", "delay 2000",
|
||||
"st rattr 0x${device.deviceNetworkId} ${endpointId} 0x0B04 0x050B", "delay 2000"
|
||||
]
|
||||
|
||||
}
|
||||
@@ -313,9 +313,9 @@ def isDescriptionPower(descMap) {
|
||||
|
||||
def onOffConfig() {
|
||||
[
|
||||
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 6 {${device.zigbeeId}} {}", "delay 200",
|
||||
"zcl global send-me-a-report 6 0 0x10 0 600 {01}",
|
||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 1500"
|
||||
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 6 {${device.zigbeeId}} {}", "delay 2000",
|
||||
"zcl global send-me-a-report 6 0 0x10 0 600 {01}", "delay 200",
|
||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 2000"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -323,9 +323,9 @@ def onOffConfig() {
|
||||
//min level change is 01
|
||||
def levelConfig() {
|
||||
[
|
||||
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 8 {${device.zigbeeId}} {}", "delay 200",
|
||||
"zcl global send-me-a-report 8 0 0x20 5 3600 {01}",
|
||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 1500"
|
||||
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 8 {${device.zigbeeId}} {}", "delay 2000",
|
||||
"zcl global send-me-a-report 8 0 0x20 5 3600 {01}", "delay 200",
|
||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 2000"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -333,9 +333,10 @@ def levelConfig() {
|
||||
//min change in value is 05
|
||||
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
|
||||
"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"
|
||||
}
|
||||
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) {
|
||||
|
||||
@@ -51,7 +51,7 @@ def on() {
|
||||
'zcl on-off on',
|
||||
'delay 200',
|
||||
"send 0x${zigbee.deviceNetworkId} 0x01 0x${zigbee.endpointId}",
|
||||
'delay 500'
|
||||
'delay 2000'
|
||||
|
||||
]
|
||||
|
||||
@@ -62,6 +62,6 @@ def off() {
|
||||
'zcl on-off off',
|
||||
'delay 200',
|
||||
"send 0x${zigbee.deviceNetworkId} 0x01 0x${zigbee.endpointId}",
|
||||
'delay 500'
|
||||
'delay 2000'
|
||||
]
|
||||
}
|
||||
|
||||
@@ -157,9 +157,10 @@ def configure() {
|
||||
//min change in value is 01
|
||||
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
|
||||
"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"
|
||||
|
||||
|
||||
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-Seu", 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-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"
|
||||
}
|
||||
|
||||
@@ -285,8 +286,8 @@ def ping() {
|
||||
def refresh() {
|
||||
log.debug "Refreshing Temperature and Battery"
|
||||
def refreshCmds = [
|
||||
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 200",
|
||||
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 200"
|
||||
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 2000",
|
||||
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 2000"
|
||||
]
|
||||
|
||||
return refreshCmds + enrollResponse()
|
||||
@@ -308,10 +309,10 @@ def enrollResponse() {
|
||||
[
|
||||
//Resending the CIE in case the enroll request is sent before CIE is written
|
||||
"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
|
||||
"raw 0x500 {01 23 00 00 00}",
|
||||
"send 0x${device.deviceNetworkId} 1 1", "delay 200"
|
||||
"raw 0x500 {01 23 00 00 00}", "delay 200",
|
||||
"send 0x${device.deviceNetworkId} 1 1", "delay 2000"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -298,8 +298,8 @@ def ping() {
|
||||
def refresh() {
|
||||
log.debug "refresh called"
|
||||
def refreshCmds = [
|
||||
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 200",
|
||||
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 200"
|
||||
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 2000",
|
||||
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 2000"
|
||||
]
|
||||
|
||||
return refreshCmds + enrollResponse()
|
||||
@@ -321,10 +321,10 @@ def enrollResponse() {
|
||||
[
|
||||
//Resending the CIE in case the enroll request is sent before CIE is written
|
||||
"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
|
||||
"raw 0x500 {01 23 00 00 00}",
|
||||
"send 0x${device.deviceNetworkId} 1 1", "delay 200"
|
||||
"raw 0x500 {01 23 00 00 00}", "delay 200",
|
||||
"send 0x${device.deviceNetworkId} 1 1", "delay 2000"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -428,10 +428,10 @@ def enrollResponse() {
|
||||
[
|
||||
//Resending the CIE in case the enroll request is sent before CIE is written
|
||||
"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
|
||||
"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"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -252,8 +252,8 @@ def ping() {
|
||||
def refresh() {
|
||||
log.debug "Refreshing Temperature and Battery"
|
||||
def refreshCmds = [
|
||||
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 200",
|
||||
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 200"
|
||||
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 2000",
|
||||
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 2000"
|
||||
]
|
||||
|
||||
return refreshCmds + enrollResponse()
|
||||
@@ -277,10 +277,10 @@ def enrollResponse() {
|
||||
[
|
||||
//Resending the CIE in case the enroll request is sent before CIE is written
|
||||
"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
|
||||
"raw 0x500 {01 23 00 00 00}",
|
||||
"send 0x${device.deviceNetworkId} 1 1", "delay 200"
|
||||
"raw 0x500 {01 23 00 00 00}", "delay 200",
|
||||
"send 0x${device.deviceNetworkId} 1 1", "delay 2000"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -270,9 +270,9 @@ def configure() {
|
||||
|
||||
log.debug "Configuring Reporting and Bindings."
|
||||
def humidityConfigCmds = [
|
||||
"zdo bind 0x${device.deviceNetworkId} 1 1 0xFC45 {${device.zigbeeId}} {}", "delay 500",
|
||||
"zcl global send-me-a-report 0xFC45 0 0x29 30 3600 {6400}",
|
||||
"send 0x${device.deviceNetworkId} 1 1", "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}", "delay 200",
|
||||
"send 0x${device.deviceNetworkId} 1 1", "delay 2000"
|
||||
]
|
||||
|
||||
// temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity
|
||||
|
||||
@@ -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, 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, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model:"3450-L", deviceJoinName: "Iris KeyFob"
|
||||
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"
|
||||
}
|
||||
|
||||
simulator {}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/**
|
||||
* Color Coordinator
|
||||
* Version 1.1.0 - 11/9/16
|
||||
* Version 1.1.1 - 11/9/16
|
||||
* By Michael Struck
|
||||
*
|
||||
* 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.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
|
||||
@@ -33,17 +34,17 @@ preferences {
|
||||
|
||||
def mainPage() {
|
||||
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) {
|
||||
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", required: true
|
||||
}
|
||||
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") {
|
||||
input "randomYes", "bool",title: "When Master Turned On, Randomize Color", defaultValue: false
|
||||
@@ -81,40 +82,44 @@ def init() {
|
||||
}
|
||||
//-----------------------------------
|
||||
def onOffHandler(evt){
|
||||
if (!slaves.id.find{it==master.id}){
|
||||
if (master.currentValue("switch") == "on"){
|
||||
if (randomYes) getRandomColorMaster()
|
||||
else slaves?.on()
|
||||
}
|
||||
else {
|
||||
slaves?.off()
|
||||
}
|
||||
if (slaves && master) {
|
||||
if (!slaves?.id.find{it==master?.id}){
|
||||
if (master?.currentValue("switch") == "on"){
|
||||
if (randomYes) getRandomColorMaster()
|
||||
else slaves?.on()
|
||||
}
|
||||
else {
|
||||
slaves?.off()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def colorHandler(evt) {
|
||||
if (!slaves.id.find{it==master.id} && master.currentValue("switch") == "on"){
|
||||
log.debug "Changing Slave units H,S,L"
|
||||
def dimLevel = master.currentValue("level")
|
||||
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 --"
|
||||
}
|
||||
if (slaves && master) {
|
||||
if (!slaves?.id?.find{it==master?.id} && master?.currentValue("switch") == "on"){
|
||||
log.debug "Changing Slave units H,S,L"
|
||||
def dimLevel = master?.currentValue("level")
|
||||
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 dimLevel = master?.currentValue("level")
|
||||
def newValue = [hue: hueLevel, saturation: saturationLevel, level: dimLevel as Integer]
|
||||
log.debug hueLevel
|
||||
log.debug saturationLevel
|
||||
@@ -123,12 +128,14 @@ def getRandomColorMaster(){
|
||||
}
|
||||
|
||||
def tempHandler(evt){
|
||||
if (!slaves.id.find{it==master.id} && master.currentValue("switch") == "on"){
|
||||
if (evt.value != "--") {
|
||||
log.debug "Changing Slave color temp based on Master change"
|
||||
def tempLevel = master.currentValue("colorTemperature")
|
||||
slaves?.setColorTemperature(tempLevel)
|
||||
}
|
||||
if (slaves && master) {
|
||||
if (!slaves?.id?.find{it==master?.id} && master?.currentValue("switch") == "on"){
|
||||
if (evt.value != "--") {
|
||||
log.debug "Changing Slave color temp based on Master change"
|
||||
def tempLevel = master.currentValue("colorTemperature")
|
||||
slaves?.setColorTemperature(tempLevel)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +146,7 @@ private def textAppName() {
|
||||
}
|
||||
|
||||
private def textVersion() {
|
||||
def text = "Version 1.1.0 (11/09/2016)"
|
||||
def text = "Version 1.1.1 (12/13/2016)"
|
||||
}
|
||||
|
||||
private def textCopyright() {
|
||||
@@ -166,4 +173,4 @@ private def textHelp() {
|
||||
"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, "+
|
||||
"including on/off conditions, hue, saturation, level and color temperature. Also includes a random color feature."
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user