mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-19 05:10:51 +00:00
Compare commits
4 Commits
MSA-861-5
...
DVCSMP-144
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eae2a9ca08 | ||
|
|
0c87601c64 | ||
|
|
a6bec43f2a | ||
|
|
5ec82217ac |
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Author: Fidure
|
* Author: Fidure
|
||||||
* Date: 2014-12-13
|
* Date: 2014-12-13
|
||||||
* Updated: 2016-1-29
|
* Updated: 2015-08-26
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
// Automatically generated. Make future change here.
|
// Automatically generated. Make future change here.
|
||||||
@@ -207,8 +207,7 @@ def parse(String description) {
|
|||||||
case "0000":
|
case "0000":
|
||||||
map.name = "temperature"
|
map.name = "temperature"
|
||||||
map.value = getTemperature(atMap.value)
|
map.value = getTemperature(atMap.value)
|
||||||
result += createEvent("name":"displayTemperature", "value":
|
result += createEvent("name":"displayTemperature", "value": getDisplayTemperature(atMap.value))
|
||||||
getDisplayTemperature(atMap.value))
|
|
||||||
break;
|
break;
|
||||||
case "0005":
|
case "0005":
|
||||||
//log.debug "hex time: ${descMap.value}"
|
//log.debug "hex time: ${descMap.value}"
|
||||||
@@ -228,7 +227,7 @@ def parse(String description) {
|
|||||||
case "0012":
|
case "0012":
|
||||||
map.name = "heatingSetpoint"
|
map.name = "heatingSetpoint"
|
||||||
map.value = getDisplayTemperature(atMap.value)
|
map.value = getDisplayTemperature(atMap.value)
|
||||||
updateSetpoint(map.name,map.value)
|
updateSetpoint(map.name,map.value)
|
||||||
break;
|
break;
|
||||||
case "001c":
|
case "001c":
|
||||||
map.name = "thermostatMode"
|
map.name = "thermostatMode"
|
||||||
@@ -340,9 +339,8 @@ def getDataLengthByType(t)
|
|||||||
"2a":3, "2b":4, "2c":5, "2d":6, "2e":7, "2f":8, "30":1, "31":2, "38":2, "39":4, "40":8, "e0":4, "e1":4, "e2":4,
|
"2a":3, "2b":4, "2c":5, "2d":6, "2e":7, "2f":8, "30":1, "31":2, "38":2, "39":4, "40":8, "e0":4, "e1":4, "e2":4,
|
||||||
"e8":2, "e9":2, "ea":4, "f0":8, "f1":16]
|
"e8":2, "e9":2, "ea":4, "f0":8, "f1":16]
|
||||||
|
|
||||||
// return number of hex chars if the type is not in the map,
|
// return number of hex chars
|
||||||
// then it's likely a malformed msg and should not be parsed
|
return map.get(t) * 2
|
||||||
return (map.get(t) ?: 256) * 2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -379,13 +377,15 @@ def updateSetpoint(attrib, val)
|
|||||||
|
|
||||||
def value = '--';
|
def value = '--';
|
||||||
|
|
||||||
if (("heat" == mode && heat != null) ||
|
|
||||||
("auto" == mode && runningMode == "heat" && heat != null))
|
|
||||||
value = (attrib == "heatingSetpoint")? val : heat;
|
|
||||||
else if (("cool" == mode && cool != null) || ("auto" == mode && runningMode == "cool" && cool != null))
|
|
||||||
value = (attrib == "coolingSetpoint")? val : cool;
|
|
||||||
|
|
||||||
|
|
||||||
|
if ("heat" == mode && heat != null)
|
||||||
|
value = heat;
|
||||||
|
else if ("cool" == mode && cool != null)
|
||||||
|
value = cool;
|
||||||
|
else if ("auto" == mode && runningMode == "cool" && cool != null)
|
||||||
|
value = cool;
|
||||||
|
else if ("auto" == mode && runningMode == "heat" && heat != null)
|
||||||
|
value = heat;
|
||||||
|
|
||||||
sendEvent("name":"displaySetpoint", "value": value)
|
sendEvent("name":"displaySetpoint", "value": value)
|
||||||
}
|
}
|
||||||
@@ -565,7 +565,7 @@ def convertToTime(data)
|
|||||||
def time = Integer.parseInt("$data", 16) as long;
|
def time = Integer.parseInt("$data", 16) as long;
|
||||||
time *= 1000;
|
time *= 1000;
|
||||||
time += 946684800000; // 481418694
|
time += 946684800000; // 481418694
|
||||||
time -= location.timeZone.getOffset(date.getTime());
|
time -= location.timeZone.getRawOffset() + location.timeZone.getDSTSavings();
|
||||||
|
|
||||||
def d = new Date(time);
|
def d = new Date(time);
|
||||||
|
|
||||||
@@ -611,14 +611,12 @@ def checkLastTimeSync(delay)
|
|||||||
if (!lastSync)
|
if (!lastSync)
|
||||||
lastSync = "${new Date(0)}"
|
lastSync = "${new Date(0)}"
|
||||||
|
|
||||||
if (!settings.sync_clock)
|
if (settings.sync_clock ?: false && lastSync != new Date(0))
|
||||||
{
|
{
|
||||||
if (lastSync != new Date(0))
|
sendEvent("name":"lastTimeSync", "value":"${new Date(0)}")
|
||||||
{
|
}
|
||||||
sendEvent("name":"lastTimeSync", "value":"${new Date(0)}")
|
|
||||||
}
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
long duration = (new Date()).getTime() - (new Date(lastSync)).getTime()
|
long duration = (new Date()).getTime() - (new Date(lastSync)).getTime()
|
||||||
|
|
||||||
@@ -807,31 +805,32 @@ def lock()
|
|||||||
//log.debug "current lock is: ${val}"
|
//log.debug "current lock is: ${val}"
|
||||||
|
|
||||||
if (val == "00")
|
if (val == "00")
|
||||||
val = getLockMap().find { it.value == (settings.lock_level ?: "Unlocked") }?.key
|
val = getLockMap().find { it.value == (settings.lock_level ?: "Full") }?.key
|
||||||
else
|
else
|
||||||
val = "00"
|
val = "00"
|
||||||
|
|
||||||
["st wattr 0x${device.deviceNetworkId} 1 0x204 1 0x30 {${val}}",
|
"st rattr 0x${device.deviceNetworkId} 1 0x204 0x01"
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 0x204 0x01", "delay 500"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def setThermostatTime()
|
def setThermostatTime()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (false == (settings.sync_clock ?: false))
|
if ((settings.sync_clock ?: false))
|
||||||
{
|
{
|
||||||
log.debug "sync time is disabled, leaving"
|
log.debug "sync time is disabled, leaving"
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
String zone = location.timeZone.getRawOffset() + " DST " + location.timeZone.getDSTSavings();
|
String zone = location.timeZone.getRawOffset() + " DST " + location.timeZone.getDSTSavings();
|
||||||
|
|
||||||
long millis = date.getTime(); // Millis since Unix epoch
|
long millis = date.getTime(); // Millis since Unix epoch
|
||||||
millis -= 946684800000; // adjust for ZigBee EPOCH
|
millis -= 946684800000; // adjust for ZigBee EPOCH
|
||||||
// adjust for time zone and DST offset
|
// adjust for time zone and DST offset
|
||||||
millis += location.timeZone.getOffset(date.getTime());
|
millis += location.timeZone.getRawOffset() + location.timeZone.getDSTSavings();
|
||||||
//convert to seconds
|
//convert to seconds
|
||||||
millis /= 1000;
|
millis /= 1000;
|
||||||
|
|
||||||
|
|||||||
@@ -100,9 +100,6 @@ metadata {
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
valueTile("3axis", "device.threeAxis", decoration: "flat", wordWrap: false, width: 2, height: 2) {
|
|
||||||
state("threeAxis", label:'${currentValue}', unit:"", backgroundColor:"#ffffff")
|
|
||||||
}
|
|
||||||
valueTile("battery", "device.battery", decoration: "flat", inactiveLabel: false, width: 2, height: 2) {
|
valueTile("battery", "device.battery", decoration: "flat", inactiveLabel: false, width: 2, height: 2) {
|
||||||
state "battery", label:'${currentValue}% battery', unit:""
|
state "battery", label:'${currentValue}% battery', unit:""
|
||||||
}
|
}
|
||||||
@@ -112,7 +109,7 @@ metadata {
|
|||||||
|
|
||||||
|
|
||||||
main(["status", "acceleration", "temperature"])
|
main(["status", "acceleration", "temperature"])
|
||||||
details(["status", "acceleration", "temperature", "3axis", "battery", "refresh"])
|
details(["status", "acceleration", "temperature", "battery", "refresh"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,28 +438,28 @@ def configure() {
|
|||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
||||||
|
|
||||||
"zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 200",
|
"zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 200",
|
||||||
"zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs
|
"zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", "delay 200", //checkin time 6 hrs
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
||||||
|
|
||||||
"zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 200",
|
"zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 200",
|
||||||
"zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}",
|
"zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
||||||
|
|
||||||
"zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0xFC02 {${device.zigbeeId}} {}", "delay 200",
|
"zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0xFC02 {${device.zigbeeId}} {}", "delay 200",
|
||||||
"zcl mfg-code ${manufacturerCode}",
|
"zcl mfg-code ${manufacturerCode}", "delay 200",
|
||||||
"zcl global send-me-a-report 0xFC02 0x0010 0x18 10 3600 {01}",
|
"zcl global send-me-a-report 0xFC02 0x0010 0x18 10 3600 {01}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
||||||
|
|
||||||
"zcl mfg-code ${manufacturerCode}",
|
"zcl mfg-code ${manufacturerCode}", "delay 200",
|
||||||
"zcl global send-me-a-report 0xFC02 0x0012 0x29 1 3600 {01}",
|
"zcl global send-me-a-report 0xFC02 0x0012 0x29 1 3600 {01}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
||||||
|
|
||||||
"zcl mfg-code ${manufacturerCode}",
|
"zcl mfg-code ${manufacturerCode}", "delay 200",
|
||||||
"zcl global send-me-a-report 0xFC02 0x0013 0x29 1 3600 {01}",
|
"zcl global send-me-a-report 0xFC02 0x0013 0x29 1 3600 {01}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
||||||
|
|
||||||
"zcl mfg-code ${manufacturerCode}",
|
"zcl mfg-code ${manufacturerCode}", "delay 200",
|
||||||
"zcl global send-me-a-report 0xFC02 0x0014 0x29 1 3600 {01}",
|
"zcl global send-me-a-report 0xFC02 0x0014 0x29 1 3600 {01}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500"
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500"
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -481,7 +478,7 @@ def enrollResponse() {
|
|||||||
"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 500",
|
||||||
//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 200"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,12 @@ metadata {
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
valueTile("3axis", "device.threeAxis", decoration: "flat", wordWrap: false, width: 2, height: 2) {
|
|
||||||
state("threeAxis", label:'${currentValue}', unit:"", backgroundColor:"#ffffff")
|
|
||||||
}
|
|
||||||
valueTile("battery", "device.battery", decoration: "flat", inactiveLabel: false, width: 2, height: 2) {
|
valueTile("battery", "device.battery", decoration: "flat", inactiveLabel: false, width: 2, height: 2) {
|
||||||
state "battery", label:'${currentValue}% battery', unit:""
|
state "battery", label:'${currentValue}% battery', unit:""
|
||||||
}
|
}
|
||||||
|
|
||||||
main(["contact", "acceleration", "temperature"])
|
main(["contact", "acceleration", "temperature"])
|
||||||
details(["contact", "acceleration", "temperature", "3axis", "battery"])
|
details(["contact", "acceleration", "temperature", "battery"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user