mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-26 13:24:09 +00:00
Handling the power issues via configuring
This commit is contained in:
@@ -287,7 +287,8 @@ def isDescriptionPower(descMap) {
|
|||||||
def powerValue = "undefined"
|
def powerValue = "undefined"
|
||||||
if (descMap.cluster == "0B04") {
|
if (descMap.cluster == "0B04") {
|
||||||
if (descMap.attrId == "050b") {
|
if (descMap.attrId == "050b") {
|
||||||
powerValue = convertHexToInt(descMap.value)
|
if(descMap.value!="ffff")
|
||||||
|
powerValue = convertHexToInt(descMap.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (descMap.clusterId == "0B04") {
|
else if (descMap.clusterId == "0B04") {
|
||||||
|
|||||||
@@ -70,9 +70,10 @@ def parse(String description) {
|
|||||||
log.debug "description is $description"
|
log.debug "description is $description"
|
||||||
|
|
||||||
def finalResult = zigbee.getKnownDescription(description)
|
def finalResult = zigbee.getKnownDescription(description)
|
||||||
|
|
||||||
//TODO: Remove this after getKnownDescription can parse it automatically
|
//TODO: Remove this after getKnownDescription can parse it automatically
|
||||||
if (!finalResult)
|
if (!finalResult && description!="updated")
|
||||||
finalResult = zigbee.getPowerDescription(zigbee.parseDescriptionAsMap(description))
|
finalResult = getPowerDescription(zigbee.parseDescriptionAsMap(description))
|
||||||
|
|
||||||
if (finalResult) {
|
if (finalResult) {
|
||||||
log.info finalResult
|
log.info finalResult
|
||||||
@@ -124,3 +125,30 @@ def powerConfig() {
|
|||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500"
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getEndpointId() {
|
||||||
|
new BigInteger(device.endpointId, 16).toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Remove this after getKnownDescription can parse it automatically
|
||||||
|
def getPowerDescription(descMap) {
|
||||||
|
def powerValue = "undefined"
|
||||||
|
if (descMap.cluster == "0B04") {
|
||||||
|
if (descMap.attrId == "050b") {
|
||||||
|
if(descMap.value!="ffff")
|
||||||
|
powerValue = convertHexToInt(descMap.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (descMap.clusterId == "0B04") {
|
||||||
|
if(descMap.command=="07"){
|
||||||
|
return [type: "update", value : "power (0B04) capability configured successfully"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (powerValue != "undefined"){
|
||||||
|
return [type: "power", value : powerValue]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "false"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user